-
-
Notifications
You must be signed in to change notification settings - Fork 35
Adds support for workspace built-in variables #232
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
Conversation
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.
I think it might also be worth adding some basic glob support for the includes. We would have to replicate the cpp extension's behaviour for that |
Pretty sure I should move the changes to |
let options = vscode.workspace.workspaceFolders | ||
? { cwd: vscode.workspace.workspaceFolders } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this option is not used at all. When running the linter the cwd passed is the one of the active file. This works well for single files but I can imagine that it does not when working on a project context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I hadn't noticed I simply updated the rootPath
option which was deprecated. I will remove options
completely.
return config.get("linterExtraArgs", ["-Wall"]); | ||
let args = config.get("linterExtraArgs", ["-Wall"]); | ||
|
||
return args.map(this.resolveVariables); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
External args passed by the user can be anything, we should not be overriding them. It can break people's workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we would be overriding something the user can define outside of VS Code, since settings.json
does not inherit shell or build-system (cmake/autoconf) variables.
So when the extension calls getLinterExtraArgs()
and the variable ${workspaceFolder}
is encountered it can be 2 things:
- An internal VS Code variable or
- A gfortran flag.
However, gfortran does not declare arguments in this format, therefore, to the best of my knowledge ${}
would be an illegal argument to pass to gfortran, and hence ${}
can be uniquely interpreted as a VS Code internal variable.
Moreover, this is very similar to how the C/C++ extension works which allows for compilerArgs
to make use of the predefined VS Code variables.
Superseded via #238 |
Now VSCode variables
${workspaceFolder}
and${workspaceRoot}
can beused in the
settings.json
file to set up include paths andoutput directories for the .mod linter files
Fixes #176.
Closes #231
Possible closure #187