mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 10:40:41 +00:00
* fix-64253 Added fixPathPrefixes * fix-64253 Removed and handled ~/path
This commit is contained in:
parent
a87dc2b62f
commit
0f5b2d14e7
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as vscode from 'vscode';
|
||||
import * as arrays from './arrays';
|
||||
import * as os from 'os';
|
||||
|
||||
export enum TsServerLogLevel {
|
||||
Off,
|
||||
|
@ -83,10 +84,21 @@ export class TypeScriptServiceConfiguration {
|
|||
&& arrays.equals(this.tsServerPluginPaths, other.tsServerPluginPaths);
|
||||
}
|
||||
|
||||
private static fixPathPrefixes(inspectValue: string): string {
|
||||
const pathPrefixes = ['~/'];
|
||||
for (const pathPrefix of pathPrefixes) {
|
||||
if (inspectValue.startsWith(pathPrefix)) {
|
||||
const homedir = os.homedir().concat('/');
|
||||
return inspectValue.replace(pathPrefix, homedir);
|
||||
}
|
||||
}
|
||||
return inspectValue;
|
||||
}
|
||||
|
||||
private static extractGlobalTsdk(configuration: vscode.WorkspaceConfiguration): string | null {
|
||||
const inspect = configuration.inspect('typescript.tsdk');
|
||||
if (inspect && typeof inspect.globalValue === 'string') {
|
||||
return inspect.globalValue;
|
||||
return this.fixPathPrefixes(inspect.globalValue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -94,7 +106,7 @@ export class TypeScriptServiceConfiguration {
|
|||
private static extractLocalTsdk(configuration: vscode.WorkspaceConfiguration): string | null {
|
||||
const inspect = configuration.inspect('typescript.tsdk');
|
||||
if (inspect && typeof inspect.workspaceValue === 'string') {
|
||||
return inspect.workspaceValue;
|
||||
return this.fixPathPrefixes(inspect.workspaceValue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue