diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-31 17:51:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-31 17:51:08 +0000 |
commit | c8b98c46675396c4f9d26c6b001e01c81d84b89e (patch) | |
tree | 40582f9bb4331676a0a469b728a5e6cfe1df5300 /editors/code/src/commands/runnables.ts | |
parent | 6d23140ba03c77b28d94e042c94155899baba9da (diff) | |
parent | cb41ffbbbdea66d3a0abae4d270da1224a5de91c (diff) |
Merge #2710
2710: Fix NPEs r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/commands/runnables.ts')
-rw-r--r-- | editors/code/src/commands/runnables.ts | 7 |
1 files changed, 4 insertions, 3 deletions
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 { | |||
8 | 8 | ||
9 | return async () => { | 9 | return async () => { |
10 | const editor = ctx.activeRustEditor; | 10 | const editor = ctx.activeRustEditor; |
11 | if (!editor) return; | 11 | const client = ctx.client; |
12 | if (!editor || !client) return; | ||
12 | 13 | ||
13 | const textDocument: lc.TextDocumentIdentifier = { | 14 | const textDocument: lc.TextDocumentIdentifier = { |
14 | uri: editor.document.uri.toString(), | 15 | uri: editor.document.uri.toString(), |
15 | }; | 16 | }; |
16 | const params: RunnablesParams = { | 17 | const params: RunnablesParams = { |
17 | textDocument, | 18 | textDocument, |
18 | position: ctx.client.code2ProtocolConverter.asPosition( | 19 | position: client.code2ProtocolConverter.asPosition( |
19 | editor.selection.active, | 20 | editor.selection.active, |
20 | ), | 21 | ), |
21 | }; | 22 | }; |
22 | const runnables = await ctx.client.sendRequest<Runnable[]>( | 23 | const runnables = await client.sendRequest<Runnable[]>( |
23 | 'rust-analyzer/runnables', | 24 | 'rust-analyzer/runnables', |
24 | params, | 25 | params, |
25 | ); | 26 | ); |