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

Commitf44e906

Browse files
g-arjonesbobbrow
authored andcommitted
Allow workspaceFolderBasename in default settings (microsoft#2503)
1 parentc206a4b commitf44e906

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

‎Extension/src/LanguageServer/configurations.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class CppProperties {
145145
publicgetConfigurations():Configuration[]{returnthis.configurationJson.configurations;}
146146
publicgetCurrentConfigurationIndex():number{returnthis.currentConfigurationIndex.Value;}
147147
publicgetCurrentConfiguration():Configuration{returnthis.Configurations[this.CurrentConfigurationIndex];}
148-
148+
149149
publicgetCurrentConfigurationProvider():string|null{
150150
if(this.CurrentConfiguration.configurationProvider){
151151
returnthis.CurrentConfiguration.configurationProvider;
@@ -202,6 +202,7 @@ export class CppProperties {
202202

203203
privateresetToDefaultSettings(resetIndex:boolean):void{
204204
this.configurationJson=getDefaultCppProperties();
205+
this.extendConfigurationEnvironment();
205206
if(resetIndex||this.CurrentConfigurationIndex<0||
206207
this.CurrentConfigurationIndex>=this.configurationJson.configurations.length){
207208
this.currentConfigurationIndex.Value=this.getConfigIndexForPlatform(this.configurationJson);
@@ -252,6 +253,14 @@ export class CppProperties {
252253
}
253254
}
254255

256+
privateextendConfigurationEnvironment():void{
257+
if(!this.configurationJson.env){
258+
this.configurationJson.env={};
259+
}
260+
261+
this.configurationJson.env["workspaceFolderBasename"]=path.basename(this.rootUri.fsPath);
262+
}
263+
255264
privateasyncbuildVcpkgIncludePath():Promise<void>{
256265
try{
257266
// Check for vcpkgRoot and include relevent paths if found.
@@ -611,11 +620,9 @@ export class CppProperties {
611620
deletethis.configurationJson.env['workspaceRoot'];
612621
deletethis.configurationJson.env['workspaceFolder'];
613622
deletethis.configurationJson.env['default'];
614-
}else{
615-
this.configurationJson.env={};
616623
}
617624

618-
this.configurationJson.env["workspaceFolderBasename"]=path.basename(this.rootUri.fsPath);
625+
this.extendConfigurationEnvironment();
619626

620627
// Warning: There is a chance that this is incorrect in the event that the c_cpp_properties.json file was created before
621628
// the system includes were available.
@@ -630,7 +637,7 @@ export class CppProperties {
630637
if(this.configurationJson.version===2){
631638
this.updateToVersion3();
632639
}
633-
640+
634641
if(this.configurationJson.version===3){
635642
this.updateToVersion4();
636643
}else{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp