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

Commitad451bb

Browse files
authored
Resolve empty array environment variablesmicrosoft#2532 (microsoft#2534)
1 parent83be111 commitad451bb

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

‎Extension/CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#C/C++ for Visual Studio Code Change Log
22

3+
##Version 0.19.0: September 26, 2018
4+
* Add support for v2 of the configuration provider API.[#2237](https://github.com/Microsoft/vscode-cpptools/issues/2237)
5+
* Add`C_Cpp.updateChannel` setting for easier access to Insider builds of the extension.[#1526](https://github.com/Microsoft/vscode-cpptools/issues/1526)
6+
* Fix bug with variable resolution.[#2532](https://github.com/Microsoft/vscode-cpptools/issues/2532)
7+
38
##Version 0.18.1: August 17, 2018
49
* Fix 0.18.0 regression causing non-MinGW compilers to use`-fms-extensions` on Windows.[#2424](https://github.com/Microsoft/vscode-cpptools/issues/2424),[#2425](https://github.com/Microsoft/vscode-cpptools/issues/2425)
510

‎Extension/src/common.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,19 @@ export function isUri(input: any): input is vscode.Uri {
176176
}
177177

178178
exportfunctionisString(input:any):input isstring{
179-
returninput&&typeof(input)==="string";
179+
returntypeof(input)==="string";
180180
}
181181

182182
exportfunctionisOptionalString(input:any):input isstring|undefined{
183-
returninput===undefined||typeof(input)==="string";
183+
returninput===undefined||isString(input);
184184
}
185185

186186
exportfunctionisArrayOfString(input:any):input isstring[]{
187-
returninput&&(inputinstanceofArray)&&input.every(item=>typeof(item)==="string");
187+
return(inputinstanceofArray)&&input.every(item=>isString(item));
188188
}
189189

190190
exportfunctionisOptionalArrayOfString(input:any):input isstring[]|undefined{
191-
returninput===undefined||((inputinstanceofArray)&&input.every(item=>typeof(item)==="string"));
191+
returninput===undefined||isArrayOfString(input);
192192
}
193193

194194
exportfunctionresolveVariables(input:string,additionalEnvironment:{[key:string]:string|string[]}):string{
@@ -211,7 +211,7 @@ export function resolveVariables(input: string, additionalEnvironment: {[key: st
211211
if(varType===undefined){
212212
varType="env";
213213
}
214-
letnewValue:string=undefined;
214+
letnewValue:string;
215215
switch(varType){
216216
case"env":{
217217
letv:string|string[]=additionalEnvironment[name];
@@ -220,7 +220,7 @@ export function resolveVariables(input: string, additionalEnvironment: {[key: st
220220
}elseif(input===match&&isArrayOfString(v)){
221221
newValue=v.join(";");
222222
}
223-
if(!newValue){
223+
if(!isString(newValue)){
224224
newValue=process.env[name];
225225
}
226226
break;
@@ -246,7 +246,7 @@ export function resolveVariables(input: string, additionalEnvironment: {[key: st
246246
}
247247
default:{assert.fail("unknown varType matched");}
248248
}
249-
return(newValue) ?newValue :match;
249+
return(isString(newValue)) ?newValue :match;
250250
});
251251
}
252252

‎Extension/test/unitTests/common.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ suite("Common Utility validation", () => {
3636
.shouldResolveTo("foo;bar");
3737
});
3838

39+
test("solo env input with empty array env value",()=>{
40+
resolveVariablesWithInput("${empty}")
41+
.withEnvironment({
42+
"empty":[]
43+
})
44+
.shouldResolveTo("");
45+
});
46+
3947
test("mixed raw and env input resulting in array",()=>{
4048
constinput:string="baz${test}";
4149
resolveVariablesWithInput(input)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp