Fix npm formatting

This commit is contained in:
Edwin Cheng 2019-11-18 03:39:11 +08:00
parent ae49a22b5c
commit 8010b42b21
2 changed files with 14 additions and 14 deletions

View file

@ -2,11 +2,13 @@ import * as vscode from 'vscode';
import { Position, TextDocumentIdentifier } from 'vscode-languageclient';
import { Server } from '../server';
type ExpandMacroResult = [string, string]
type ExpandMacroResult = [string, string];
function code_format([name, text]: [string, string]): vscode.MarkdownString {
const markdown = new vscode.MarkdownString(`#### Recursive expansion of ${name}! macro`);
markdown.appendCodeblock(text, 'rust');
const markdown = new vscode.MarkdownString(
`#### Recursive expansion of ${name}! macro`
);
markdown.appendCodeblock(text, 'rust');
return markdown;
}
@ -14,12 +16,12 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
public provideHover(
document: vscode.TextDocument,
position: vscode.Position,
token: vscode.CancellationToken,
token: vscode.CancellationToken
): Thenable<vscode.Hover | null> | null {
async function handle() {
const request: MacroExpandParams = {
textDocument: { uri: document.uri.toString() },
position,
position
};
const result = await Server.client.sendRequest<ExpandMacroResult>(
'rust-analyzer/expandMacro',
@ -31,15 +33,13 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
}
return null;
};
}
return handle();
}
}
interface MacroExpandParams {
textDocument: TextDocumentIdentifier;
position: Position;
}

View file

@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
import * as commands from './commands';
import { CargoWatchProvider } from './commands/cargo_watch';
import { ExpandMacroHoverProvider } from './commands/expand_macro'
import { ExpandMacroHoverProvider } from './commands/expand_macro';
import { HintsUpdater } from './commands/inlay_hints';
import {
interactivelyStartCargoWatch,
@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) {
const allNotifications: Iterable<
[string, lc.GenericNotificationHandler]
> = [
[
'rust-analyzer/publishDecorations',
notifications.publishDecorations.handle
]
];
[
'rust-analyzer/publishDecorations',
notifications.publishDecorations.handle
]
];
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
// The events below are plain old javascript events, triggered and handled by vscode