mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
fix #31553
This commit is contained in:
@@ -386,8 +386,8 @@ export function createApiFactory(
|
||||
apiUsage.publicLog('workspace#onDidChangeWorkspaceFolders');
|
||||
return extHostWorkspace.onDidChangeWorkspace(listener, thisArgs, disposables);
|
||||
},
|
||||
asRelativePath: (pathOrUri) => {
|
||||
return extHostWorkspace.getRelativePath(pathOrUri);
|
||||
asRelativePath: (pathOrUri, includeWorkspace) => {
|
||||
return extHostWorkspace.getRelativePath(pathOrUri, includeWorkspace);
|
||||
},
|
||||
findFiles: (include, exclude, maxResults?, token?) => {
|
||||
return extHostWorkspace.findFiles(include, exclude, maxResults, token);
|
||||
|
||||
@@ -117,7 +117,7 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
return roots[0].fsPath;
|
||||
}
|
||||
|
||||
getRelativePath(pathOrUri: string | vscode.Uri): string {
|
||||
getRelativePath(pathOrUri: string | vscode.Uri, includeWorkspace?: boolean): string {
|
||||
|
||||
let path: string;
|
||||
if (typeof pathOrUri === 'string') {
|
||||
@@ -139,8 +139,12 @@ export class ExtHostWorkspace extends ExtHostWorkspaceShape {
|
||||
return normalize(path);
|
||||
}
|
||||
|
||||
if (typeof includeWorkspace === 'undefined') {
|
||||
includeWorkspace = this.workspace.roots.length > 1;
|
||||
}
|
||||
|
||||
let result = relative(folder.uri.fsPath, path);
|
||||
if (this.workspace.roots.length > 1) {
|
||||
if (includeWorkspace) {
|
||||
result = `${folder.name}/${result}`;
|
||||
}
|
||||
return normalize(result);
|
||||
|
||||
Reference in New Issue
Block a user