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

Commitc206a4b

Browse files
g-arjonesbobbrow
authored andcommitted
Add support for 'workspaceFolderBasename' expansion (microsoft#2491) (microsoft#2495)
1 parent9e95e41 commitc206a4b

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

‎Extension/c_cpp_properties.schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"type":"object",
122122
"description":"Custom variables that can be reused anywhere in this file using the ${variable} or ${env:variable} syntax.",
123123
"patternProperties": {
124-
"(?!^workspaceFolder$)(?!^workspaceRoot$)(?!^default$)(^.+$)": {
124+
"(?!^workspaceFolder$)(?!^workspaceRoot$)(?!^workspaceFolderBasename$)(?!^default$)(^.+$)": {
125125
"oneOf": [
126126
{
127127
"type":"string"

‎Extension/src/LanguageServer/client.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ class DefaultClient implements Client {
240240
returnthis.trackedDocuments;
241241
}
242242

243+
privategetAdditionalEnvironment():{[key:string]:string|string[]}{
244+
return{workspaceFolderBasename:this.Name};
245+
}
246+
243247
privategetName(workspaceFolder?:vscode.WorkspaceFolder):string{
244248
returnworkspaceFolder ?workspaceFolder.name :"untitled";
245249
}
@@ -337,7 +341,7 @@ class DefaultClient implements Client {
337341
},
338342
workspaceFolder:workspaceFolder,
339343
initializationOptions:{
340-
clang_format_path:util.resolveVariables(settings.clangFormatPath,null),
344+
clang_format_path:util.resolveVariables(settings.clangFormatPath,this.AdditionalEnvironment),
341345
clang_format_style:settings.clangFormatStyle,
342346
clang_format_fallbackStyle:settings.clangFormatFallbackStyle,
343347
clang_format_sortIncludes:settings.clangFormatSortIncludes,
@@ -405,7 +409,7 @@ class DefaultClient implements Client {
405409
}
406410
if(changedSettings["clang_format_path"]){
407411
letsettings:CppSettings=newCppSettings(this.RootUri);
408-
this.languageClient.sendNotification(UpdateClangFormatPathNotification,util.resolveVariables(settings.clangFormatPath,null));
412+
this.languageClient.sendNotification(UpdateClangFormatPathNotification,util.resolveVariables(settings.clangFormatPath,this.AdditionalEnvironment));
409413
}
410414
this.configuration.onDidChangeSettings();
411415
telemetry.logLanguageServerEvent("CppSettingsChange",changedSettings,null);
@@ -1206,4 +1210,4 @@ class NullClient implements Client {
12061210
this.stringEvent.dispose();
12071211
returnPromise.resolve();
12081212
}
1209-
}
1213+
}

‎Extension/src/LanguageServer/configurations.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,12 @@ export class CppProperties {
611611
deletethis.configurationJson.env['workspaceRoot'];
612612
deletethis.configurationJson.env['workspaceFolder'];
613613
deletethis.configurationJson.env['default'];
614+
}else{
615+
this.configurationJson.env={};
614616
}
615617

618+
this.configurationJson.env["workspaceFolderBasename"]=path.basename(this.rootUri.fsPath);
619+
616620
// Warning: There is a chance that this is incorrect in the event that the c_cpp_properties.json file was created before
617621
// the system includes were available.
618622
this.configurationIncomplete=false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp