aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands/expand_macro.ts16
-rw-r--r--editors/code/src/extension.ts12
2 files changed, 14 insertions, 14 deletions
diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts
index bf1923190..d024a70e0 100644
--- a/editors/code/src/commands/expand_macro.ts
+++ b/editors/code/src/commands/expand_macro.ts
@@ -2,11 +2,13 @@ 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] 5type ExpandMacroResult = [string, string];
6 6
7function code_format([name, text]: [string, string]): vscode.MarkdownString { 7function code_format([name, text]: [string, string]): vscode.MarkdownString {
8 const markdown = new vscode.MarkdownString(`#### Recursive expansion of ${name}! macro`); 8 const markdown = new vscode.MarkdownString(
9 markdown.appendCodeblock(text, 'rust'); 9 `#### Recursive expansion of ${name}! macro`
10 );
11 markdown.appendCodeblock(text, 'rust');
10 return markdown; 12 return markdown;
11} 13}
12 14
@@ -14,12 +16,12 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
14 public provideHover( 16 public provideHover(
15 document: vscode.TextDocument, 17 document: vscode.TextDocument,
16 position: vscode.Position, 18 position: vscode.Position,
17 token: vscode.CancellationToken, 19 token: vscode.CancellationToken
18 ): Thenable<vscode.Hover | null> | null { 20 ): Thenable<vscode.Hover | null> | null {
19 async function handle() { 21 async function handle() {
20 const request: MacroExpandParams = { 22 const request: MacroExpandParams = {
21 textDocument: { uri: document.uri.toString() }, 23 textDocument: { uri: document.uri.toString() },
22 position, 24 position
23 }; 25 };
24 const result = await Server.client.sendRequest<ExpandMacroResult>( 26 const result = await Server.client.sendRequest<ExpandMacroResult>(
25 'rust-analyzer/expandMacro', 27 'rust-analyzer/expandMacro',
@@ -31,15 +33,13 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
31 } 33 }
32 34
33 return null; 35 return null;
34 }; 36 }
35 37
36 return handle(); 38 return handle();
37 } 39 }
38} 40}
39 41
40
41interface MacroExpandParams { 42interface MacroExpandParams {
42 textDocument: TextDocumentIdentifier; 43 textDocument: TextDocumentIdentifier;
43 position: Position; 44 position: Position;
44} 45}
45
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 1dfa6046f..8654b6030 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
3 3
4import * as commands from './commands'; 4import * as commands from './commands';
5import { CargoWatchProvider } from './commands/cargo_watch'; 5import { CargoWatchProvider } from './commands/cargo_watch';
6import { ExpandMacroHoverProvider } from './commands/expand_macro' 6import { ExpandMacroHoverProvider } from './commands/expand_macro';
7import { HintsUpdater } from './commands/inlay_hints'; 7import { HintsUpdater } from './commands/inlay_hints';
8import { 8import {
9 interactivelyStartCargoWatch, 9 interactivelyStartCargoWatch,
@@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) {
92 const allNotifications: Iterable< 92 const allNotifications: Iterable<
93 [string, lc.GenericNotificationHandler] 93 [string, lc.GenericNotificationHandler]
94 > = [ 94 > = [
95 [ 95 [
96 'rust-analyzer/publishDecorations', 96 'rust-analyzer/publishDecorations',
97 notifications.publishDecorations.handle 97 notifications.publishDecorations.handle
98 ] 98 ]
99 ]; 99 ];
100 const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); 100 const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
101 101
102 // The events below are plain old javascript events, triggered and handled by vscode 102 // The events below are plain old javascript events, triggered and handled by vscode