introduce new variable ${fileWorkspaceFolder}; fixes #84162

This commit is contained in:
Andre Weinand
2020-11-16 13:05:34 +01:00
parent b04e9c8f9d
commit 876d1f09cc
4 changed files with 59 additions and 46 deletions

View File

@@ -105,7 +105,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
constructor(
@IExtHostRpcService extHostRpcService: IExtHostRpcService,
@IExtHostWorkspace private _workspaceService: IExtHostWorkspace,
@IExtHostWorkspace protected _workspaceService: IExtHostWorkspace,
@IExtHostExtensionService private _extensionService: IExtHostExtensionService,
@IExtHostDocumentsAndEditors private _editorsService: IExtHostDocumentsAndEditors,
@IExtHostConfiguration protected _configurationService: IExtHostConfiguration,
@@ -930,7 +930,7 @@ export class ExtHostDebugConsole implements vscode.DebugConsole {
export class ExtHostVariableResolverService extends AbstractVariableResolverService {
constructor(folders: vscode.WorkspaceFolder[], editorService: ExtHostDocumentsAndEditors | undefined, configurationService: ExtHostConfigProvider, env?: IProcessEnvironment) {
constructor(folders: vscode.WorkspaceFolder[], editorService: ExtHostDocumentsAndEditors | undefined, configurationService: ExtHostConfigProvider, env?: IProcessEnvironment, workspaceService?: IExtHostWorkspace) {
super({
getFolderUri: (folderName: string): URI | undefined => {
const found = folders.filter(f => f.name === folderName);
@@ -957,6 +957,18 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
}
return undefined;
},
getWorkspaceFolderPathForFile: (): string | undefined => {
if (editorService && workspaceService) {
const activeEditor = editorService.activeEditor();
if (activeEditor) {
const ws = workspaceService.getWorkspaceFolder(activeEditor.document.uri);
if (ws) {
return path.normalize(ws.uri.fsPath);
}
}
}
return undefined;
},
getSelectedText: (): string | undefined => {
if (editorService) {
const activeEditor = editorService.activeEditor();
@@ -975,7 +987,7 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
}
return undefined;
}
}, undefined, env, !editorService);
}, undefined, env);
}
}