mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Fix npm formatting
This commit is contained in:
parent
ae49a22b5c
commit
8010b42b21
2 changed files with 14 additions and 14 deletions
|
@ -2,11 +2,13 @@ import * as vscode from 'vscode';
|
||||||
import { Position, TextDocumentIdentifier } from 'vscode-languageclient';
|
import { Position, TextDocumentIdentifier } from 'vscode-languageclient';
|
||||||
import { Server } from '../server';
|
import { Server } from '../server';
|
||||||
|
|
||||||
type ExpandMacroResult = [string, string]
|
type ExpandMacroResult = [string, string];
|
||||||
|
|
||||||
function code_format([name, text]: [string, string]): vscode.MarkdownString {
|
function code_format([name, text]: [string, string]): vscode.MarkdownString {
|
||||||
const markdown = new vscode.MarkdownString(`#### Recursive expansion of ${name}! macro`);
|
const markdown = new vscode.MarkdownString(
|
||||||
markdown.appendCodeblock(text, 'rust');
|
`#### Recursive expansion of ${name}! macro`
|
||||||
|
);
|
||||||
|
markdown.appendCodeblock(text, 'rust');
|
||||||
return markdown;
|
return markdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +16,12 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
|
||||||
public provideHover(
|
public provideHover(
|
||||||
document: vscode.TextDocument,
|
document: vscode.TextDocument,
|
||||||
position: vscode.Position,
|
position: vscode.Position,
|
||||||
token: vscode.CancellationToken,
|
token: vscode.CancellationToken
|
||||||
): Thenable<vscode.Hover | null> | null {
|
): Thenable<vscode.Hover | null> | null {
|
||||||
async function handle() {
|
async function handle() {
|
||||||
const request: MacroExpandParams = {
|
const request: MacroExpandParams = {
|
||||||
textDocument: { uri: document.uri.toString() },
|
textDocument: { uri: document.uri.toString() },
|
||||||
position,
|
position
|
||||||
};
|
};
|
||||||
const result = await Server.client.sendRequest<ExpandMacroResult>(
|
const result = await Server.client.sendRequest<ExpandMacroResult>(
|
||||||
'rust-analyzer/expandMacro',
|
'rust-analyzer/expandMacro',
|
||||||
|
@ -31,15 +33,13 @@ export class ExpandMacroHoverProvider implements vscode.HoverProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
}
|
||||||
|
|
||||||
return handle();
|
return handle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface MacroExpandParams {
|
interface MacroExpandParams {
|
||||||
textDocument: TextDocumentIdentifier;
|
textDocument: TextDocumentIdentifier;
|
||||||
position: Position;
|
position: Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as lc from 'vscode-languageclient';
|
||||||
|
|
||||||
import * as commands from './commands';
|
import * as commands from './commands';
|
||||||
import { CargoWatchProvider } from './commands/cargo_watch';
|
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 { HintsUpdater } from './commands/inlay_hints';
|
||||||
import {
|
import {
|
||||||
interactivelyStartCargoWatch,
|
interactivelyStartCargoWatch,
|
||||||
|
@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
const allNotifications: Iterable<
|
const allNotifications: Iterable<
|
||||||
[string, lc.GenericNotificationHandler]
|
[string, lc.GenericNotificationHandler]
|
||||||
> = [
|
> = [
|
||||||
[
|
[
|
||||||
'rust-analyzer/publishDecorations',
|
'rust-analyzer/publishDecorations',
|
||||||
notifications.publishDecorations.handle
|
notifications.publishDecorations.handle
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
|
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
|
||||||
|
|
||||||
// The events below are plain old javascript events, triggered and handled by vscode
|
// The events below are plain old javascript events, triggered and handled by vscode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue