Skip to content

Commit

Permalink
fix: avoid executePluginCommand duplicate error
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 25, 2022
1 parent 776337a commit 572b785
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions examples/vscode-angular/src/client.ts
Expand Up @@ -43,8 +43,6 @@ export async function activate(context: vscode.ExtensionContext) {
},
cancellationPipeName,
noProjectReferences: true,
// @ts-expect-error
__noPluginCommands: true,
};
const serverModule = vscode.Uri.joinPath(context.extensionUri, 'server.js');
const runOptions = { execArgv: <string[]>[] };
Expand Down
Expand Up @@ -171,10 +171,7 @@ export function setupSemanticCapabilities(
resolveProvider: true,
};
server.executeCommandProvider = { commands: [...server.executeCommandProvider?.commands ?? []] };
// @ts-expect-error
if (!initOptions.__noPluginCommands) {
server.executeCommandProvider.commands.push(embedded.executePluginCommand);
}
server.executeCommandProvider.commands.push(embedded.executePluginCommand);
}
if (!initOptions.respectClientCapabilities || params.textDocument?.semanticTokens) {
server.semanticTokensProvider = {
Expand Down
Expand Up @@ -2,7 +2,9 @@ import type { LanguageServiceRuntimeContext } from '../types';
import { ExecuteCommandContext } from '@volar/language-service';
import * as vscode from 'vscode-languageserver-protocol';

export const executePluginCommand = 'volar.executePluginCommand';
const randomCommandId = Math.random().toString(36).slice(2); // TODO

export const executePluginCommand = `volar.${randomCommandId}.executePluginCommand`;

export type ExecutePluginCommandArgs = [
string, // uri
Expand Down

0 comments on commit 572b785

Please sign in to comment.