aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/syntaxTree.ts
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-09 07:16:36 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-09 07:16:36 +0100
commitc9798c0e6da53c132021f03ac7a50ccd8714b371 (patch)
tree0d6d49b2eb40ad161a72adbfbf9874b64540bf74 /editors/code/src/commands/syntaxTree.ts
parentf4ad36e972989c3feed8671d6d6fca0aed37cd8f (diff)
parente26071d96e1ff56289213dbe78415f836de8a70e (diff)
Merge #104
104: Add vscode extension to CI r=aochagavia a=DJMcNab Note that this testing is only done on travis - we are only running formatting and linting, so feature parity on appveyor is not required. CC @aochagavia. Fixes? #100 Co-authored-by: Daniel McNab <[email protected]>
Diffstat (limited to 'editors/code/src/commands/syntaxTree.ts')
-rw-r--r--editors/code/src/commands/syntaxTree.ts24
1 files changed, 18 insertions, 6 deletions
diff --git a/editors/code/src/commands/syntaxTree.ts b/editors/code/src/commands/syntaxTree.ts
index dcb721eee..5d5cdd7a0 100644
--- a/editors/code/src/commands/syntaxTree.ts
+++ b/editors/code/src/commands/syntaxTree.ts
@@ -5,17 +5,25 @@ import { Server } from '../server';
5 5
6export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); 6export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree');
7 7
8export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { 8export class TextDocumentContentProvider
9 implements vscode.TextDocumentContentProvider {
9 public eventEmitter = new vscode.EventEmitter<vscode.Uri>(); 10 public eventEmitter = new vscode.EventEmitter<vscode.Uri>();
10 public syntaxTree: string = 'Not available'; 11 public syntaxTree: string = 'Not available';
11 12
12 public provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> { 13 public provideTextDocumentContent(
14 uri: vscode.Uri
15 ): vscode.ProviderResult<string> {
13 const editor = vscode.window.activeTextEditor; 16 const editor = vscode.window.activeTextEditor;
14 if (editor == null) { return ''; } 17 if (editor == null) {
18 return '';
19 }
15 const request: SyntaxTreeParams = { 20 const request: SyntaxTreeParams = {
16 textDocument: { uri: editor.document.uri.toString() }, 21 textDocument: { uri: editor.document.uri.toString() }
17 }; 22 };
18 return Server.client.sendRequest<SyntaxTreeResult>('m/syntaxTree', request); 23 return Server.client.sendRequest<SyntaxTreeResult>(
24 'm/syntaxTree',
25 request
26 );
19 } 27 }
20 28
21 get onDidChange(): vscode.Event<vscode.Uri> { 29 get onDidChange(): vscode.Event<vscode.Uri> {
@@ -34,5 +42,9 @@ type SyntaxTreeResult = string;
34// The contents of the file come from the `TextDocumentContentProvider` 42// The contents of the file come from the `TextDocumentContentProvider`
35export async function handle() { 43export async function handle() {
36 const document = await vscode.workspace.openTextDocument(syntaxTreeUri); 44 const document = await vscode.workspace.openTextDocument(syntaxTreeUri);
37 return vscode.window.showTextDocument(document, vscode.ViewColumn.Two, true); 45 return vscode.window.showTextDocument(
46 document,
47 vscode.ViewColumn.Two,
48 true
49 );
38} 50}