mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-21 10:49:07 +00:00
Make RelativeWorkspacePathResolver a static class
This commit is contained in:
@@ -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)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user