TysonAndre / vscode-php-phan

Phan - PHP Static Analysis for VS Code
Other
24 stars 4 forks source link

checkValidAnalyzedProjectDirectory vs --config-file #64

Open anibalsanchez opened 5 years ago

anibalsanchez commented 5 years ago

Hi,

The extension checks if there is a config file in the defined phan.analyzedProjectDirectory (function checkValidAnalyzedProjectDirectory).

Phan supports the CLI argument -k/--config-file parameter to use an external config file. This option does not work in the extension and it is being ignored by the checkValidAnalyzedProjectDirectory validation.

Thanks, great extension!

anibalsanchez commented 5 years ago

For instance, you can trick vscode-php-phan with an empty .phan/config.php file to load the external config.php.

TysonAndre commented 5 years ago

analyzedProjectDirectory supports an array of one or more project directories, so they can't all use the same --config-file. Adding --config-file works for a single project, but not for multiple projects.

So my plan to solve this would be "analyzedProjectDirectory": ['/path/to/project1', {"dir": "/path/to/project2", "configFile": "/path/to/project2/alternate/phan_config.php"}] - support either strings or complex configs for the project directories (and document supported options).

anibalsanchez commented 5 years ago

The simplest solution would be a way to disable the checkValidAnalyzedProjectDirectory validation.

"analyzedProjectDirectory" as an array is a nice feature. But in my case, I have the projects separated in its own space (not integrated into a VSCode workspace). So, I don't use it.

Ideally, if analyzedProjectDirectory is an array, each project could have its own set of arguments.

TysonAndre commented 5 years ago

The simplest solution would be a way to disable the checkValidAnalyzedProjectDirectory validation.

I could add an option to allow that (off by default)

anibalsanchez commented 5 years ago

Cool. Great addition.