Skip to content

Support ${workspaceFolder} in includePaths and linterExtraArgs #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dnwillia-work opened this issue May 6, 2020 · 6 comments
Closed
Assignees

Comments

@dnwillia-work
Copy link

dnwillia-work commented May 6, 2020

This variable is supported by other code parsers (eg: C++ parser from Microsoft). It would be great if it was working since it allows teams using VS code to keep a single project settings.json file in the git repo and have team members clone to wherever they like. For example:

"fortran.includePaths": [
  "${workspaceFolder}/myincludes",
  "${workspaceFolder}/mymodules" ],
"fortran.linterExtraArgs": [
  "-J${workspaceFolder}/mymodules"]

then it would just work.

Looks like maybe a straightforward change here at the bottom of the file?

@dnwillia-work dnwillia-work changed the title Support ${workspacePath} in include and custom linter arguments Support ${workspacePath} in includePaths and linterExtraArgs May 6, 2020
@pedro-ricardo
Copy link
Collaborator

That's a good suggestion 👍
I'll need to search for a reference in other extensions to know how to interpret the sting and get that ${workspacePath} value.
Doesn't sound complicated.

@dnwillia-work dnwillia-work changed the title Support ${workspacePath} in includePaths and linterExtraArgs Support ${workspaceFolder} in includePaths and linterExtraArgs May 18, 2020
@dnwillia-work
Copy link
Author

dnwillia-work commented May 18, 2020

Great, thanks. Seems I made a mistake though, the correct variable is ${workspaceFolder}. I've updated the title and my opening post.

@dnwillia-work
Copy link
Author

Looking at this link seems what you want is vscode.workspace.workspaceFolder[0]

@nyckmaia
Copy link

The variable "${workspaceFolder}" is now working in "fortran.includePaths".

Is the a solution?

@gnikit
Copy link
Member

gnikit commented Jun 1, 2021

As far as I can tell, for this to be functional and general a bit more work will need to be done since the paths in includePaths would still need to be resolved for ${workspace} variables, similarly to how it is done in the C++ extension.
Same applies for linterExtraArgs.

I see what I can come up with although I will admit that TypeScript is not my strong suit

@gnikit gnikit self-assigned this Jun 1, 2021
gnikit added a commit to gnikit/vscode-fortran-support that referenced this issue Jun 1, 2021
Now VSCode variables `${workspaceFolder} and `${workspaceRoot}` can be
used in the `settings.json` file to set up include paths and
output directories for the .mod linter files

Fixes fortran-lang#176.
@gnikit gnikit linked a pull request Jun 8, 2021 that will close this issue
@gnikit
Copy link
Member

gnikit commented Nov 17, 2021

This is now in v2.6.1 available in the VS marketplace. Also glob patterns in include paths are now supported but be careful not to give overly general globs because gfortran has a limit to the number of arguments it can have during compilation.

@gnikit gnikit closed this as completed Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants