mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Run prettier
This commit is contained in:
parent
a0c0350960
commit
57df9bed70
2 changed files with 16 additions and 20 deletions
|
@ -2,30 +2,26 @@ import * as vscode from 'vscode';
|
||||||
import * as lc from 'vscode-languageclient';
|
import * as lc from 'vscode-languageclient';
|
||||||
import { Server } from './server';
|
import { Server } from './server';
|
||||||
|
|
||||||
|
|
||||||
export class Ctx {
|
export class Ctx {
|
||||||
private extCtx: vscode.ExtensionContext
|
private extCtx: vscode.ExtensionContext;
|
||||||
|
|
||||||
constructor(extCtx: vscode.ExtensionContext) {
|
constructor(extCtx: vscode.ExtensionContext) {
|
||||||
this.extCtx = extCtx
|
this.extCtx = extCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
get client(): lc.LanguageClient {
|
get client(): lc.LanguageClient {
|
||||||
return Server.client
|
return Server.client;
|
||||||
}
|
}
|
||||||
|
|
||||||
registerCommand(
|
registerCommand(name: string, factory: (ctx: Ctx) => Cmd) {
|
||||||
name: string,
|
const fullName = `rust-analyzer.${name}`;
|
||||||
factory: (ctx: Ctx) => Cmd,
|
|
||||||
) {
|
|
||||||
const fullName = `rust-analyzer.${name}`
|
|
||||||
const cmd = factory(this);
|
const cmd = factory(this);
|
||||||
const d = vscode.commands.registerCommand(fullName, cmd);
|
const d = vscode.commands.registerCommand(fullName, cmd);
|
||||||
this.pushCleanup(d);
|
this.pushCleanup(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushCleanup(d: { dispose(): any }) {
|
pushCleanup(d: { dispose(): any }) {
|
||||||
this.extCtx.subscriptions.push(d)
|
this.extCtx.subscriptions.push(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { StatusDisplay } from './commands/watch_status';
|
||||||
import * as events from './events';
|
import * as events from './events';
|
||||||
import * as notifications from './notifications';
|
import * as notifications from './notifications';
|
||||||
import { Server } from './server';
|
import { Server } from './server';
|
||||||
import { Ctx } from './ctx'
|
import { Ctx } from './ctx';
|
||||||
|
|
||||||
let ctx!: Ctx;
|
let ctx!: Ctx;
|
||||||
|
|
||||||
|
@ -94,15 +94,15 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||||
string,
|
string,
|
||||||
lc.GenericNotificationHandler,
|
lc.GenericNotificationHandler,
|
||||||
]> = [
|
]> = [
|
||||||
[
|
[
|
||||||
'rust-analyzer/publishDecorations',
|
'rust-analyzer/publishDecorations',
|
||||||
notifications.publishDecorations.handle,
|
notifications.publishDecorations.handle,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'$/progress',
|
'$/progress',
|
||||||
params => watchStatus.handleProgressNotification(params),
|
params => watchStatus.handleProgressNotification(params),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
|
const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
|
||||||
const expandMacroContentProvider = new ExpandMacroContentProvider();
|
const expandMacroContentProvider = new ExpandMacroContentProvider();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue