Restart query server when external config changes#2289
Merged
aeisenberg merged 3 commits intomainfrom Apr 12, 2023
Merged
Conversation
This avoids manually restarting the query server when this file changes.
koesie10
reviewed
Apr 11, 2023
extensions/ql-vscode/CHANGELOG.md
Outdated
| ## [UNRELEASED] | ||
|
|
||
| - Restart the CodeQL language server whenever the _CodeQL: Restart Query Server_ command is invoked. This avoids bugs where the CLI version changes to support new language features, but the language server is not updated. [#2238](https://github.com/github/vscode-codeql/pull/2238) | ||
| - Avoid requiring a manual restart of the query server when the [external CLI config file](https://un5n6892w35rcyxcrjj28.julianrbryant.com/en/code-security/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-codeql-configuration-file) changes. [#22892289) |
Member
There was a problem hiding this comment.
Suggested change
| - Avoid requiring a manual restart of the query server when the [external CLI config file](https://un5n6892w35rcyxcrjj28.julianrbryant.com/en/code-security/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-codeql-configuration-file) changes. [#22892289) | |
| - Avoid requiring a manual restart of the query server when the [external CLI config file](https://un5n6892w35rcyxcrjj28.julianrbryant.com/en/code-security/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-codeql-configuration-file) changes. [#2289](https://github.com/github/vscode-codeql/pull/2289) |
| * See https://un5n6892w35rcyxcrjj28.julianrbryant.com/en/code-security/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-codeql-configuration-file | ||
| */ | ||
| function watchExternalConfigFile(app: ExtensionApp, ctx: ExtensionContext) { | ||
| if (process.env.HOME) { |
Member
There was a problem hiding this comment.
Do we not want to have this work on Windows? It seems like we can call os.homedir() to get the home directory in a platform independent way.
Contributor
Author
There was a problem hiding this comment.
Ah...right. I forgot about that. I will fix.
| */ | ||
| function watchExternalConfigFile(app: ExtensionApp, ctx: ExtensionContext) { | ||
| if (process.env.HOME) { | ||
| const configPath = join(process.env.HOME, ".config/codeql", "config"); |
Member
There was a problem hiding this comment.
I think it would be better to be consistent in how we join here:
Suggested change
| const configPath = join(process.env.HOME, ".config/codeql", "config"); | |
| const configPath = join(process.env.HOME, ".config", "codeql", "config"); |
koesie10
approved these changes
Apr 12, 2023
Comment on lines
+1022
to
+1023
| if (homedir()) { | ||
| const configPath = join(homedir(), ".config", "codeql", "config"); |
Member
There was a problem hiding this comment.
(Optional) I think it would be a little bit more safe and faster to store the homedir() result in a variable to avoid duplicate calls.
d5952d3 to
6de58ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This avoids manually restarting the query server when this file changes.
Fixes #1141
Replace this with a description of the changes your pull request makes.
Checklist
ready-for-doc-reviewlabel there.