Skip to content

Commit 0539406

Browse files
committed
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 PowerShell#810. Resolves PowerShell/PowerShellEditorServices PowerShell#434.
1 parent b5c0abe commit 0539406

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/features/ExtensionCommands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export class ExtensionCommandsFeature implements IFeature {
313313

314314
private getEditorContext(): EditorContext {
315315
return {
316-
currentFilePath: vscode.window.activeTextEditor.document.fileName,
316+
currentFilePath: vscode.window.activeTextEditor.document.uri.toString(),
317317
cursorPosition: asPosition(vscode.window.activeTextEditor.selection.active),
318318
selectionRange:
319319
asRange(

0 commit comments

Comments
 (0)