PerlNavigator
PerlNavigator copied to clipboard
Document use $workspaceFolder in includePaths
In the "perlnavigator.includePaths" setting, it would be useful to support one or more variables so that you can specify relative paths. This would be useful if you have multiple projects with the same structure, so you don't have to copy-paste-modify a bunch of absolute paths into the Workspace Settings. For example, any of these variables: https://code.visualstudio.com/docs/editor/variables-reference or a custom variable (PLS uses $ROOT_PATH in that extension).
Alternatively, follow the Perl Language Server (PLS) extension example and include a separate setting for the cwd. This is less flexible but could work.
Hi Jon, thanks for filing the issue. Currently the includePaths setting supports $workspaceFolder as a variable, which can be used like $workspaceFolder/foo as well. If you have single folder open, $workspaceFolder works as expected. If you have a multi-root workspace (i.e. a workspace with multiple folders), a path for every folder will be add to Perl's include path. It's ok if some of those paths don't exist, Perl is robust to those types of issues.
This is in package.json, which should show up as hover information when editing settings.json. However, I see that it is not included in the documentation at all and should be added.
Additionally, I just made a recent change to always include ./lib by default, but that change has not yet been pushed to the vscode marketplace.
Thanks for the quick response! That's exactly what I was looking for. Documentation would be great.
Currently the extension settings for Include Paths say Array of paths added to @INC. You can use $workspaceRoot as a placeholder..
$workspaceRoot/lib didn't work for me, but $workspaceFolder/lib did.
The vscode 1.62 settings autocomplete didn't suggest $workspaceRoot but $workspaceFolder when editing settings.json so I guess the variable was renamed in some vscode version.
Please update the settings comment to use $workspaceFolder.
This is complete. The settings and the readme both show the usage of $workspaceFolder. This variable works for includepaths, perlcriticprofile, and the perltidy profile. Thanks for your patience and thanks for filing the report.