mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Run prettier on all files
This commit is contained in:
parent
3a405b65d6
commit
e26071d96e
23 changed files with 220 additions and 129 deletions
|
@ -5,17 +5,25 @@ import { Server } from '../server';
|
|||
|
||||
export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree');
|
||||
|
||||
export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider {
|
||||
export class TextDocumentContentProvider
|
||||
implements vscode.TextDocumentContentProvider {
|
||||
public eventEmitter = new vscode.EventEmitter<vscode.Uri>();
|
||||
public syntaxTree: string = 'Not available';
|
||||
|
||||
public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> {
|
||||
public provideTextDocumentContent(
|
||||
uri: vscode.Uri
|
||||
): vscode.ProviderResult<string> {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor == null) { return ''; }
|
||||
if (editor == null) {
|
||||
return '';
|
||||
}
|
||||
const request: SyntaxTreeParams = {
|
||||
textDocument: { uri: editor.document.uri.toString() },
|
||||
textDocument: { uri: editor.document.uri.toString() }
|
||||
};
|
||||
return Server.client.sendRequest<SyntaxTreeResult>('m/syntaxTree', request);
|
||||
return Server.client.sendRequest<SyntaxTreeResult>(
|
||||
'm/syntaxTree',
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
get onDidChange(): vscode.Event<vscode.Uri> {
|
||||
|
@ -34,5 +42,9 @@ type SyntaxTreeResult = string;
|
|||
// The contents of the file come from the `TextDocumentContentProvider`
|
||||
export async function handle() {
|
||||
const document = await vscode.workspace.openTextDocument(syntaxTreeUri);
|
||||
return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true);
|
||||
return vscode.window.showTextDocument(
|
||||
document,
|
||||
vscode.ViewColumn.Two,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue