aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-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 );