aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-19 14:56:48 +0000
committerEdwin Cheng <[email protected]>2019-11-19 14:56:48 +0000
commit4012da07fd22223660a21c65d54d10a9a632eda0 (patch)
tree1081edcfc24b16ba0d0433d40e499458039aa5f3 /editors/code/src/commands
parent94c63d280246971983cad4fa6ce2d333e3ba9f02 (diff)
Change return type of expand_macro
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/expand_macro.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts
index d024a70e0..3fc3e0391 100644
--- a/editors/code/src/commands/expand_macro.ts
+++ b/editors/code/src/commands/expand_macro.ts
@@ -2,13 +2,16 @@ import * as vscode from 'vscode';
2import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; 2import { Position, TextDocumentIdentifier } from 'vscode-languageclient';
3import { Server } from '../server'; 3import { Server } from '../server';
4 4
5type ExpandMacroResult = [string, string]; 5interface ExpandedMacro {
6 name: string,
7 expansion: string,
8}
6 9
7function code_format([name, text]: [string, string]): vscode.MarkdownString { 10function code_format(expanded: ExpandedMacro): vscode.MarkdownString {
8 const markdown = new vscode.MarkdownString( 11 const markdown = new vscode.MarkdownString(
9 `#### Recursive expansion of ${name}! macro` 12 `#### Recursive expansion of ${expanded.name}! macro`
10 ); 13 );
11 markdown.appendCodeblock(text, 'rust'); 14 markdown.appendCodeblock(expanded.expansion, 'rust');
12 return markdown; 15 return markdown;
13} 16}
14 17
@@ -23,7 +26,7 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
23 textDocument: { uri: document.uri.toString() }, 26 textDocument: { uri: document.uri.toString() },
24 position 27 position
25 }; 28 };
26 const result = await Server.client.sendRequest<ExpandMacroResult>( 29 const result = await Server.client.sendRequest<ExpandedMacro>(
27 'rust-analyzer/expandMacro', 30 'rust-analyzer/expandMacro',
28 request 31 request
29 ); 32 );