Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit485dbde

Browse files
authored
Fix issue with invoking commands before cpptools is activated (microsoft#8821)
1 parent1772769 commit485dbde

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { createProtocolFilter } from './protocolFilter';
3333
import{DataBinding}from'./dataBinding';
3434
importminimatch= require("minimatch");
3535
import*asloggerfrom'../logger';
36-
import{updateLanguageConfigurations,registerCommands,CppSourceStr}from'./extension';
36+
import{updateLanguageConfigurations,CppSourceStr}from'./extension';
3737
import{SettingsTracker,getTracker}from'./settingsTracker';
3838
import{getTestHook,TestHook}from'../testHook';
3939
import{getCustomConfigProviders,CustomConfigurationProvider1,isSameProviderExtensionId}from'../LanguageServer/customProviders';
@@ -1004,10 +1004,8 @@ export class DefaultClient implements Client {
10041004
compilerDefaults=inputCompilerDefaults;
10051005
this.configuration.CompilerDefaults=compilerDefaults;
10061006

1007-
// Only register file watchers, providers,andthe real commands after the extension has finished initializing,
1007+
// Only register file watchersandproviders after the extension has finished initializing,
10081008
// e.g. prevents empty c_cpp_properties.json from generation.
1009-
registerCommands();
1010-
10111009
this.registerFileWatcher();
10121010

10131011
this.disposables.push(vscode.languages.registerRenameProvider(this.documentSelector,newRenameProvider(this)));
@@ -3068,6 +3066,7 @@ export class DefaultClient implements Client {
30683066
next:next
30693067
};
30703068

3069+
awaitthis.awaitUntilLanguageClientReady();
30713070
constresponse:Position|undefined=awaitthis.languageClient.sendRequest(GoToDirectiveInGroupRequest,params);
30723071
if(response){
30733072
constp:vscode.Position=newvscode.Position(response.line,response.character);

‎Extension/src/LanguageServer/extension.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ export async function activate(): Promise<void> {
276276
clients.ActiveClient.notifyWhenLanguageClientReady(()=>{
277277
intervalTimer=global.setInterval(onInterval,2500);
278278
});
279+
280+
registerCommands();
279281
}
280282

281283
exportfunctionupdateLanguageConfigurations():void{
@@ -401,14 +403,7 @@ function onInterval(): void {
401403
/**
402404
* registered commands
403405
*/
404-
letcommandsRegistered:boolean=false;
405-
406406
exportfunctionregisterCommands():void{
407-
if(commandsRegistered){
408-
return;
409-
}
410-
411-
commandsRegistered=true;
412407
disposables.push(vscode.commands.registerCommand('C_Cpp.SwitchHeaderSource',onSwitchHeaderSource));
413408
disposables.push(vscode.commands.registerCommand('C_Cpp.ResetDatabase',onResetDatabase));
414409
disposables.push(vscode.commands.registerCommand('C_Cpp.ConfigurationSelect',onSelectConfiguration));

‎Extension/src/main.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
7676
}
7777
}));
7878
}
79-
LanguageServer.activate();
79+
awaitLanguageServer.activate();
8080

8181
UpdateInsidersAccess();
8282

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp