Convert extensions/ql-vscode/src/log-insights/summary-language-support.ts to call typed commands

This commit is contained in:
Robert 2023-03-23 12:03:38 +00:00
Родитель d56a986cc5
Коммит 6b3a235a77
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -876,7 +876,7 @@ async function activateWithInstalledDistribution(
ctx.subscriptions.push(astViewer); ctx.subscriptions.push(astViewer);
const summaryLanguageSupport = new SummaryLanguageSupport(); const summaryLanguageSupport = new SummaryLanguageSupport(app);
ctx.subscriptions.push(summaryLanguageSupport); ctx.subscriptions.push(summaryLanguageSupport);
const mockServer = new VSCodeMockGitHubApiServer(ctx); const mockServer = new VSCodeMockGitHubApiServer(ctx);

Просмотреть файл

@ -1,7 +1,6 @@
import { readFile } from "fs-extra"; import { readFile } from "fs-extra";
import { RawSourceMap, SourceMapConsumer } from "source-map"; import { RawSourceMap, SourceMapConsumer } from "source-map";
import { import {
commands,
Position, Position,
Selection, Selection,
TextDocument, TextDocument,
@ -16,6 +15,7 @@ import { DisposableObject } from "../pure/disposable-object";
import { extLogger } from "../common"; import { extLogger } from "../common";
import { getErrorMessage } from "../pure/helpers-pure"; import { getErrorMessage } from "../pure/helpers-pure";
import { SummaryLanguageSupportCommands } from "../common/commands"; import { SummaryLanguageSupportCommands } from "../common/commands";
import { App } from "../common/app";
/** A `Position` within a specified file on disk. */ /** A `Position` within a specified file on disk. */
interface PositionInFile { interface PositionInFile {
@ -55,7 +55,7 @@ export class SummaryLanguageSupport extends DisposableObject {
*/ */
private sourceMap: SourceMapConsumer | undefined = undefined; private sourceMap: SourceMapConsumer | undefined = undefined;
constructor() { constructor(private readonly app: App) {
super(); super();
this.push( this.push(
@ -160,7 +160,7 @@ export class SummaryLanguageSupport extends DisposableObject {
private async updateContext(): Promise<void> { private async updateContext(): Promise<void> {
const position = await this.getQLSourceLocation(); const position = await this.getQLSourceLocation();
await commands.executeCommand( await this.app.commands.execute(
"setContext", "setContext",
"codeql.hasQLSource", "codeql.hasQLSource",
position !== undefined, position !== undefined,