From 8cb0645dc1d682698d85cc95b3f263cf99445b92 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 31 May 2017 16:20:58 -0700 Subject: [PATCH] Send document Uri instead of path for extension command execution This change fixes an issue which causes the language server to crash when running a registered $psEditor command from within an untitled file. This happens because the workspace code in the language server expects to receive Uri paths instead of local file paths when referring to an editor buffer. The fix is to send the untitled file's Uri instead of its non-existent file path. Resolves #810. Resolves PowerShell/PowerShellEditorServices #434. --- src/features/ExtensionCommands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/ExtensionCommands.ts b/src/features/ExtensionCommands.ts index d107829549..3ffb929717 100644 --- a/src/features/ExtensionCommands.ts +++ b/src/features/ExtensionCommands.ts @@ -313,7 +313,7 @@ export class ExtensionCommandsFeature implements IFeature { private getEditorContext(): EditorContext { return { - currentFilePath: vscode.window.activeTextEditor.document.fileName, + currentFilePath: vscode.window.activeTextEditor.document.uri.toString(), cursorPosition: asPosition(vscode.window.activeTextEditor.selection.active), selectionRange: asRange(