-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pull-pylance-with-pyright-1.1.270 (#3920)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com> Co-authored-by: HeeJae Chang <hechang@microsoft.com> Co-authored-by: Erik De Bonte <erikd@microsoft.com>
- Loading branch information
1 parent
2d195c1
commit 95c059f
Showing
15 changed files
with
326 additions
and
149 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* envVarUtils.ts | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT license. | ||
* | ||
* Utils functions that handles environment variables. | ||
*/ | ||
|
||
// Expands certain predefined variables supported within VS Code settings. | ||
// Ideally, VS Code would provide an API for doing this expansion, but | ||
// it doesn't. We'll handle the most common variables here as a convenience. | ||
export function expandPathVariables(rootPath: string, value: string): string { | ||
const regexp = /\$\{(.*?)\}/g; | ||
return value.replace(regexp, (match: string, name: string) => { | ||
const trimmedName = name.trim(); | ||
if (trimmedName === 'workspaceFolder') { | ||
return rootPath; | ||
} | ||
if (trimmedName === 'env:HOME' && process.env.HOME !== undefined) { | ||
return process.env.HOME; | ||
} | ||
if (trimmedName === 'env:USERNAME' && process.env.USERNAME !== undefined) { | ||
return process.env.USERNAME; | ||
} | ||
if (trimmedName === 'env:VIRTUAL_ENV' && process.env.VIRTUAL_ENV !== undefined) { | ||
return process.env.VIRTUAL_ENV; | ||
} | ||
return match; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.