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

Commita0e0254

Browse files
authored
Add a setting to silence configuration provider warnings (microsoft#2293)
* Add a setting to silence configuration provider warnings
1 parent5289053 commita0e0254

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

‎Extension/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Fix`#include` autocomplete with Mac framework headers.[#2251](https://github.com/Microsoft/vscode-cpptools/issues/2251)
2222
* Fix for debugging to support empty arguments for debuggee.[#2258](https://github.com/Microsoft/vscode-cpptools/issues/2258)
2323
* Fix`Go to Definition` bug (missing symbols outside the workspace).[#2281](https://github.com/Microsoft/vscode-cpptools/issues/2281)
24+
* Add a setting to silence configuration provider warnings.[#2292](https://github.com/Microsoft/vscode-cpptools/issues/2292)
2425
* Fix for debugging async Visual C++ causing debugger to hang.
2526
* Fix`main` snippet.
2627

‎Extension/package.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,16 @@
250250
"description":"Defines the editor behavior for when the Enter key is pressed inside a multiline or single line comment block.",
251251
"scope":"resource"
252252
},
253+
"C_Cpp.configurationWarnings": {
254+
"type":"string",
255+
"enum": [
256+
"Enabled",
257+
"Disabled"
258+
],
259+
"default":"Enabled",
260+
"description":"Determines whether pop up notifications will be shown when a configuration provider extension is unable to provide a configuration for a source file.",
261+
"scope":"resource"
262+
},
253263
"C_Cpp.default.includePath": {
254264
"type": [
255265
"array",

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { getTestHook, TestHook } from '../testHook';
3030
import{getCustomConfigProviders,CustomConfigurationProviderCollection,CustomConfigurationProvider1}from'../LanguageServer/customProviders';
3131

3232
letui:UI;
33+
constconfigProviderTimeout:number=2000;
3334

3435
interfaceNavigationPayload{
3536
navigation:string;
@@ -430,17 +431,18 @@ class DefaultClient implements Client {
430431
letfolderStr:string=(vscode.workspace.workspaceFolders&&vscode.workspace.workspaceFolders.length>1) ?"the '"+this.Name+"'" :"this";
431432
constmessage:string=`${provider.name} would like to configure IntelliSense for${folderStr} folder.`;
432433
constallow:string="Allow";
433-
constnotNow:string="Not Now";
434-
constdontAskAgain:string="Don'tAskAgain";
435-
vscode.window.showInformationMessage(message,allow,notNow,dontAskAgain).then(result=>{
434+
constdontAllow:string="Don't Allow";
435+
constaskLater:string="AskMe Later";
436+
vscode.window.showInformationMessage(message,allow,dontAllow,askLater).then(result=>{
436437
switch(result){
437438
caseallow:{
438439
this.configuration.updateCustomConfigurationProvider(provider.extensionId).then(()=>{
439440
telemetry.logLanguageServerEvent("customConfigurationProvider",{"providerId":provider.extensionId});
440441
});
442+
ask.Value=false;
441443
break;
442444
}
443-
casedontAskAgain:{
445+
casedontAllow:{
444446
ask.Value=false;
445447
break;
446448
}
@@ -475,7 +477,7 @@ class DefaultClient implements Client {
475477
lettask:()=>Thenable<SourceFileConfigurationItem[]>=()=>{
476478
returncurrentProvider.provideConfigurations(documentUris,tokenSource.token);
477479
};
478-
this.queueTaskWithTimeout(task,1000,tokenSource).then(configs=>this.sendCustomConfigurations(configs));
480+
this.queueTaskWithTimeout(task,configProviderTimeout,tokenSource).then(configs=>this.sendCustomConfigurations(configs));
479481
});
480482
}
481483

@@ -508,17 +510,29 @@ class DefaultClient implements Client {
508510
returnPromise.reject("");
509511
};
510512

511-
returnthis.queueTaskWithTimeout(provideConfigurationAsync,1000,tokenSource).then(
513+
returnthis.queueTaskWithTimeout(provideConfigurationAsync,configProviderTimeout,tokenSource).then(
512514
(configs:SourceFileConfigurationItem[])=>{
513515
if(configs&&configs.length>0){
514516
this.sendCustomConfigurations(configs);
515517
}
516518
},
517519
()=>{
518-
if(!this.isExternalHeader(document)&&!vscode.debug.activeDebugSession){
520+
letsettings:CppSettings=newCppSettings(this.RootUri);
521+
if(settings.configurationWarnings==="Enabled"&&!this.isExternalHeader(document)&&!vscode.debug.activeDebugSession){
522+
constdismiss:string="Dismiss";
523+
constdisable:string="Disable Warnings";
519524
vscode.window.showInformationMessage(
520525
`'${providerName}' is unable to provide IntelliSense configuration information for '${document.uri.fsPath}'. `+
521-
`Settings from the '${configName}' configuration will be used instead.`);
526+
`Settings from the '${configName}' configuration will be used instead.`,
527+
dismiss,
528+
disable).then(response=>{
529+
switch(response){
530+
casedisable:{
531+
settings.toggleSetting("configurationWarnings","Enabled","Disabled");
532+
break;
533+
}
534+
}
535+
});
522536
}
523537
});
524538
}

‎Extension/src/LanguageServer/settings.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class CppSettings extends Settings {
4848
publicgetworkspaceParsingPriority():boolean{returnsuper.Section.get<boolean>("workspaceParsingPriority");}
4949
publicgetexclusionPolicy():boolean{returnsuper.Section.get<boolean>("exclusionPolicy");}
5050
publicgetcommentContinuationPatterns():(string|CommentPattern)[]{returnsuper.Section.get<(string|CommentPattern)[]>("commentContinuationPatterns");}
51+
publicgetconfigurationWarnings():string{returnsuper.Section.get<string>("configurationWarnings");}
5152
publicgetpreferredPathSeparator():string{returnsuper.Section.get<string>("preferredPathSeparator");}
5253
publicgetdefaultIncludePath():string[]{returnsuper.Section.get<string[]>("default.includePath");}
5354
publicgetdefaultDefines():string[]{returnsuper.Section.get<string[]>("default.defines");}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp