Skip to content

Commit

Permalink
Merge pull request #67182 from njkevlani/sendSequence_snippets
Browse files Browse the repository at this point in the history
Resolve vars in text for sendSequence to Terminal
  • Loading branch information
Tyriar authored Feb 3, 2019
2 parents 2b0fc3b + ac41612 commit b6d1da9
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import { Command } from 'vs/editor/browser/editorExtensions';
import { timeout } from 'vs/base/common/async';
import { FindReplaceState } from 'vs/editor/contrib/find/findState';
import { ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { Schemas } from 'vs/base/common/network';
import { URI } from 'vs/base/common/uri';

export const TERMINAL_PICKER_PREFIX = 'term ';
Expand Down Expand Up @@ -283,7 +286,14 @@ export class SendSequenceTerminalCommand extends Command {
if (!terminalInstance) {
return;
}
terminalInstance.sendText(args.text, false);

const configurationResolverService = accessor.get(IConfigurationResolverService);
const workspaceContextService = accessor.get(IWorkspaceContextService);
const historyService = accessor.get(IHistoryService);
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(Schemas.file);
const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) : null;
const resolvedText = configurationResolverService.resolve(lastActiveWorkspaceRoot, args.text);
terminalInstance.sendText(resolvedText, false);
}
}

Expand Down

0 comments on commit b6d1da9

Please sign in to comment.