Merge pull request #2213 from github/koesie10/check-for-updates-typed-command
Add `codeQL.checkForUpdatesToCLI` type for command
This commit is contained in:
@@ -39,6 +39,13 @@ export type BuiltInVsCodeCommands = {
|
|||||||
"workbench.action.reloadWindow": () => Promise<void>;
|
"workbench.action.reloadWindow": () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Commands that are available before the extension is fully activated.
|
||||||
|
// These commands are *not* registered using the command manager, but can
|
||||||
|
// be invoked using the command manager.
|
||||||
|
export type PreActivationCommands = {
|
||||||
|
"codeQL.checkForUpdatesToCLI": () => Promise<void>;
|
||||||
|
};
|
||||||
|
|
||||||
// Base commands not tied directly to a module like e.g. variant analysis.
|
// Base commands not tied directly to a module like e.g. variant analysis.
|
||||||
export type BaseCommands = {
|
export type BaseCommands = {
|
||||||
"codeQL.openDocumentation": () => Promise<void>;
|
"codeQL.openDocumentation": () => Promise<void>;
|
||||||
@@ -240,7 +247,7 @@ export type MockGitHubApiServerCommands = {
|
|||||||
"codeQL.mockGitHubApiServer.unloadScenario": () => Promise<void>;
|
"codeQL.mockGitHubApiServer.unloadScenario": () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// All commands where the implementation is provided by this extension.
|
// All commands where the implementation is provided by this activated extension.
|
||||||
export type AllExtensionCommands = BaseCommands &
|
export type AllExtensionCommands = BaseCommands &
|
||||||
QueryEditorCommands &
|
QueryEditorCommands &
|
||||||
ResultsViewCommands &
|
ResultsViewCommands &
|
||||||
@@ -256,7 +263,9 @@ export type AllExtensionCommands = BaseCommands &
|
|||||||
Partial<TestUICommands> &
|
Partial<TestUICommands> &
|
||||||
MockGitHubApiServerCommands;
|
MockGitHubApiServerCommands;
|
||||||
|
|
||||||
export type AllCommands = AllExtensionCommands & BuiltInVsCodeCommands;
|
export type AllCommands = AllExtensionCommands &
|
||||||
|
PreActivationCommands &
|
||||||
|
BuiltInVsCodeCommands;
|
||||||
|
|
||||||
export type AppCommandManager = CommandManager<AllCommands>;
|
export type AppCommandManager = CommandManager<AllCommands>;
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ import { QueryHistoryDirs } from "./query-history/query-history-dirs";
|
|||||||
import {
|
import {
|
||||||
AllExtensionCommands,
|
AllExtensionCommands,
|
||||||
BaseCommands,
|
BaseCommands,
|
||||||
|
PreActivationCommands,
|
||||||
QueryServerCommands,
|
QueryServerCommands,
|
||||||
TestUICommands,
|
TestUICommands,
|
||||||
} from "./common/commands";
|
} from "./common/commands";
|
||||||
@@ -235,6 +236,8 @@ function registerErrorStubs(
|
|||||||
|
|
||||||
stubbedCommands.forEach((command) => {
|
stubbedCommands.forEach((command) => {
|
||||||
if (excludedCommands.indexOf(command) === -1) {
|
if (excludedCommands.indexOf(command) === -1) {
|
||||||
|
// This is purposefully using `commandRunner` instead of the command manager because these
|
||||||
|
// commands are untyped and registered pre-activation.
|
||||||
errorStubs.push(commandRunner(command, stubGenerator(command)));
|
errorStubs.push(commandRunner(command, stubGenerator(command)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -336,6 +339,8 @@ export async function activate(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
ctx.subscriptions.push(
|
ctx.subscriptions.push(
|
||||||
|
// This is purposefully using `commandRunner` directly instead of the command manager
|
||||||
|
// because this command is registered pre-activation.
|
||||||
commandRunner(checkForUpdatesCommand, () =>
|
commandRunner(checkForUpdatesCommand, () =>
|
||||||
installOrUpdateThenTryActivate(
|
installOrUpdateThenTryActivate(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -1089,7 +1094,8 @@ async function initializeLogging(ctx: ExtensionContext): Promise<void> {
|
|||||||
ctx.subscriptions.push(ideServerLogger);
|
ctx.subscriptions.push(ideServerLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkForUpdatesCommand = "codeQL.checkForUpdatesToCLI";
|
const checkForUpdatesCommand: keyof PreActivationCommands =
|
||||||
|
"codeQL.checkForUpdatesToCLI" as const;
|
||||||
|
|
||||||
const avoidVersionCheck = "avoid-version-check-at-startup";
|
const avoidVersionCheck = "avoid-version-check-at-startup";
|
||||||
const lastVersionChecked = "last-version-checked";
|
const lastVersionChecked = "last-version-checked";
|
||||||
|
|||||||
Reference in New Issue
Block a user