Skip to content

Commit 725828c

Browse files
authored
disable the config provider message for headers outside the workspace & while debugging (#2239)
* disable the config provider message for headers & while debugging * leave the message on for headers inside the workspace folder
1 parent 8b18854 commit 725828c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,17 @@ class DefaultClient implements Client {
513513
}
514514
},
515515
() => {
516-
vscode.window.showInformationMessage(`'${providerName}' is unable to provide IntelliSense configuration information for '${document.uri.fsPath}'. Settings from the '${configName}' configuration will be used instead.`);
516+
if (!this.isExternalHeader(document) && !vscode.debug.activeDebugSession) {
517+
vscode.window.showInformationMessage(
518+
`'${providerName}' is unable to provide IntelliSense configuration information for '${document.uri.fsPath}'. ` +
519+
`Settings from the '${configName}' configuration will be used instead.`);
520+
}
517521
});
518522
}
523+
524+
private isExternalHeader(document: vscode.TextDocument): boolean {
525+
return util.isHeader(document) && !document.uri.toString().startsWith(this.RootUri.toString());
526+
}
519527

520528
public getCustomConfigurationProviderId(): Thenable<string|undefined> {
521529
return this.queueTask(() => Promise.resolve(this.configuration.CurrentConfiguration.configurationProvider));

Extension/src/common.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ export function getVcpkgRoot(): string {
7373
return vcpkgRoot;
7474
}
7575

76+
/**
77+
* This is a fuzzy determination of whether a uri represents a header file.
78+
* For the purposes of this function, a header file has no extension, or an extension that begins with the letter 'h'.
79+
* @param document The document to check.
80+
*/
81+
export function isHeader(document: vscode.TextDocument): boolean {
82+
let ext: string = path.extname(document.uri.fsPath);
83+
return !ext || ext.startsWith(".h") || ext.startsWith(".H");
84+
}
85+
7686
// Extension is ready if install.lock exists and debugAdapters folder exist.
7787
export async function isExtensionReady(): Promise<boolean> {
7888
const doesInstallLockFileExist: boolean = await checkInstallLockFile();

0 commit comments

Comments
 (0)