Convert call sites to use typed commands (part 3)#2229
Conversation
…t.ts to call typed commands
…o call typed commands
…o call typed commands
…o call typed commands
…nager.ts to call typed commands
…nitor.ts to call typed commands
| this.push( | ||
| config.onDidChangeConfiguration(() => | ||
| commands.executeCommand("codeQL.restartQueryServer"), | ||
| app.commands.execute("codeQL.restartQueryServer"), |
Check warning
Code scanning / CodeQL
A VS Code command should not be used in multiple locations
| private readonly ctx: ExtensionContext, | ||
| private readonly app: App, |
There was a problem hiding this comment.
It feels strange to be passing in both the context and the app. I believe both of the properties that this class accesses on the context (extensionMode and extensionUri) also exist on the app as mode and extensionPath. I think it would be best to switch to those in this PR as well, even though the change is unrelated.
There was a problem hiding this comment.
That sounds good to me. I didn't really have it clear in my head what the point of ExtensionContext was and how it relates to the app, but I see now the app can replace the extension context in some places. The context is stored as a field on the app, so it can act as a platform-independent interface to those values.
I can take a look (not in this PR) to see if there are more places where we pass both types and if it could be simplified.
Follows on from earlier PRs and converts some more places to call typed commands.
The only non-trivial bit of this PR is around
VariantAnalysisMonitor:monitorVariantAnalysismethod.codeQL.autoDownloadVariantAnalysisResultcommand was called, but then also asserting that theVariantAnalysisManager. autoDownloadVariantAnalysisResultmethod was called. This only works if it's actually executing commands rather than using a mock, and is also not very necessary. I decided to remove these and just check that the command was called, and this made the tests a lot simpler.Checklist
ready-for-doc-reviewlabel there.