提交 e3015a2e 编写于 作者: D Daniel Imms 提交者: GitHub

Merge pull request #16422 from mjbvz/fix-16421

Fix null exception on runSelectedText Terminal Action for Webview
......@@ -198,15 +198,17 @@ export class RunSelectedTextInTerminalAction extends Action {
terminalInstance = this.terminalService.createInstance();
}
let editor = this.codeEditorService.getFocusedCodeEditor();
let selection = editor.getSelection();
let text: string;
if (selection.isEmpty()) {
text = editor.getValue();
} else {
let endOfLinePreference = os.EOL === '\n' ? EndOfLinePreference.LF : EndOfLinePreference.CRLF;
text = editor.getModel().getValueInRange(selection, endOfLinePreference);
if (editor) {
let selection = editor.getSelection();
let text: string;
if (selection.isEmpty()) {
text = editor.getValue();
} else {
let endOfLinePreference = os.EOL === '\n' ? EndOfLinePreference.LF : EndOfLinePreference.CRLF;
text = editor.getModel().getValueInRange(selection, endOfLinePreference);
}
terminalInstance.sendText(text, true);
}
terminalInstance.sendText(text, true);
return TPromise.as(void 0);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册