提交 e32e2a90 编写于 作者: M Matt Bierner

Make RelativeWorkspacePathResolver a static class

上级 8119b4ae
......@@ -9,7 +9,6 @@ import { RelativeWorkspacePathResolver } from './relativePathResolver';
export class TypeScriptPluginPathsProvider {
public readonly relativePathResolver: RelativeWorkspacePathResolver = new RelativeWorkspacePathResolver();
public constructor(
private configuration: TypeScriptServiceConfiguration
......@@ -32,7 +31,7 @@ export class TypeScriptPluginPathsProvider {
return [pluginPath];
}
const workspacePath = this.relativePathResolver.asAbsoluteWorkspacePath(pluginPath);
const workspacePath = RelativeWorkspacePathResolver.asAbsoluteWorkspacePath(pluginPath);
if (workspacePath !== undefined) {
return [workspacePath];
}
......
......@@ -6,7 +6,7 @@ import * as path from 'path';
import * as vscode from 'vscode';
export class RelativeWorkspacePathResolver {
public asAbsoluteWorkspacePath(relativePath: string): string | undefined {
public static asAbsoluteWorkspacePath(relativePath: string): string | undefined {
for (const root of vscode.workspace.workspaceFolders || []) {
const rootPrefixes = [`./${root.name}/`, `${root.name}/`, `.\\${root.name}\\`, `${root.name}\\`];
for (const rootPrefix of rootPrefixes) {
......
......@@ -88,7 +88,6 @@ export class TypeScriptVersion {
}
export class TypeScriptVersionProvider {
private readonly relativePathResolver: RelativeWorkspacePathResolver = new RelativeWorkspacePathResolver();
public constructor(
private configuration: TypeScriptServiceConfiguration
......@@ -179,7 +178,7 @@ export class TypeScriptVersionProvider {
return [new TypeScriptVersion(tsdkPathSetting)];
}
const workspacePath = this.relativePathResolver.asAbsoluteWorkspacePath(tsdkPathSetting);
const workspacePath = RelativeWorkspacePathResolver.asAbsoluteWorkspacePath(tsdkPathSetting);
if (workspacePath !== undefined) {
return [new TypeScriptVersion(workspacePath, tsdkPathSetting)];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册