提交 cf44fd64 编写于 作者: A Andre Weinand

remove getEnvironmentService from IVariableAccessor

上级 4cce36ad
...@@ -547,8 +547,8 @@ export class ExtHostVariableResolverService implements IConfigurationResolverSer ...@@ -547,8 +547,8 @@ export class ExtHostVariableResolverService implements IConfigurationResolverSer
getConfigurationValue: (folderUri: URI, section: string) => { getConfigurationValue: (folderUri: URI, section: string) => {
return configuration.getConfiguration(undefined, folderUri).get<string>(section); return configuration.getConfiguration(undefined, folderUri).get<string>(section);
}, },
getEnvironmentService: (name: string): string => { getExecPath: (): string | undefined => {
return undefined; return undefined; // does not exist in EH
}, },
getFilePath: (): string | undefined => { getFilePath: (): string | undefined => {
const activeEditor = editors.activeEditor(); const activeEditor = editors.activeEditor();
...@@ -561,7 +561,6 @@ export class ExtHostVariableResolverService implements IConfigurationResolverSer ...@@ -561,7 +561,6 @@ export class ExtHostVariableResolverService implements IConfigurationResolverSer
return undefined; return undefined;
}, },
getSelectedText: (): string | undefined => { getSelectedText: (): string | undefined => {
debugger;
const activeEditor = editors.activeEditor(); const activeEditor = editors.activeEditor();
if (activeEditor && !activeEditor.selection.isEmpty) { if (activeEditor && !activeEditor.selection.isEmpty) {
return activeEditor.document.getText(activeEditor.selection); return activeEditor.document.getText(activeEditor.selection);
......
...@@ -45,8 +45,8 @@ export class ConfigurationResolverService implements IConfigurationResolverServi ...@@ -45,8 +45,8 @@ export class ConfigurationResolverService implements IConfigurationResolverServi
getConfigurationValue: (folderUri: uri, suffix: string) => { getConfigurationValue: (folderUri: uri, suffix: string) => {
return configurationService.getValue<string>(suffix, folderUri ? { resource: folderUri } : undefined); return configurationService.getValue<string>(suffix, folderUri ? { resource: folderUri } : undefined);
}, },
getEnvironmentService: (name: string) => { getExecPath: () => {
return environmentService[name]; return environmentService['execPath'];
}, },
getFilePath: (): string | undefined => { getFilePath: (): string | undefined => {
let input = editorService.getActiveEditorInput(); let input = editorService.getActiveEditorInput();
......
...@@ -17,7 +17,7 @@ export interface IVariableAccessor { ...@@ -17,7 +17,7 @@ export interface IVariableAccessor {
getFolderUri(folderName: string): uri | undefined; getFolderUri(folderName: string): uri | undefined;
getWorkspaceFolderCount(): number; getWorkspaceFolderCount(): number;
getConfigurationValue(folderUri: uri, section: string): string | undefined; getConfigurationValue(folderUri: uri, section: string): string | undefined;
getEnvironmentService(name: string): string | undefined; getExecPath(): string | undefined;
getFilePath(): string | undefined; getFilePath(): string | undefined;
getSelectedText(): string | undefined; getSelectedText(): string | undefined;
getLineNumber(): string; getLineNumber(): string;
...@@ -193,7 +193,11 @@ export class VariableResolver { ...@@ -193,7 +193,11 @@ export class VariableResolver {
return basename.slice(0, basename.length - paths.extname(basename).length); return basename.slice(0, basename.length - paths.extname(basename).length);
case 'execPath': case 'execPath':
return this.accessor.getEnvironmentService('execPath'); const ep = this.accessor.getExecPath();
if (ep) {
return ep;
}
throw new Error(localize('canNotResolveExecPath', "'{0}' can not be resolved.", match));
default: default:
return match; return match;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册