-
Notifications
You must be signed in to change notification settings - Fork 191
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
Restart query server when external config changes #2289
Conversation
This avoids manually restarting the query server when this file changes.
extensions/ql-vscode/CHANGELOG.md
Outdated
@@ -3,6 +3,7 @@ | |||
## [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://docs.github.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) |
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.
- Avoid requiring a manual restart of the query server when the [external CLI config file](https://docs.github.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://docs.github.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://docs.github.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) { |
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.
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.
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.
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"); |
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 think it would be better to be consistent in how we join here:
const configPath = join(process.env.HOME, ".config/codeql", "config"); | |
const configPath = join(process.env.HOME, ".config", "codeql", "config"); |
if (homedir()) { | ||
const configPath = join(homedir(), ".config", "codeql", "config"); |
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.
(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.
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.
Sure. Done.
d5952d3
to
6de58ec
Compare
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-review
label there.