From cb41ffbbbdea66d3a0abae4d270da1224a5de91c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:50:32 +0100 Subject: Fix NPEs --- editors/code/src/commands/runnables.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'editors/code/src/commands/runnables.ts') diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 8cd86c21e..7919997ce 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts @@ -8,18 +8,19 @@ export function run(ctx: Ctx): Cmd { return async () => { const editor = ctx.activeRustEditor; - if (!editor) return; + const client = ctx.client; + if (!editor || !client) return; const textDocument: lc.TextDocumentIdentifier = { uri: editor.document.uri.toString(), }; const params: RunnablesParams = { textDocument, - position: ctx.client.code2ProtocolConverter.asPosition( + position: client.code2ProtocolConverter.asPosition( editor.selection.active, ), }; - const runnables = await ctx.client.sendRequest( + const runnables = await client.sendRequest( 'rust-analyzer/runnables', params, ); -- cgit v1.2.3