about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <aochagavia92@gmail.com>2018-10-09 22:56:15 +0200
committerAdolfo OchagavĂ­a <aochagavia92@gmail.com>2018-10-09 22:56:22 +0200
commitf2d719b24afd404dbaf26332ff314a6161c74b71 (patch)
tree54c1381ec3d57cbd0722053900e02f3a7ad10cd2 /editors/code/src
parent31c8ebb743572ef07ac4ca77ddd17eddbcf4b24c (diff)
downloadrust-f2d719b24afd404dbaf26332ff314a6161c74b71.tar.gz
rust-f2d719b24afd404dbaf26332ff314a6161c74b71.zip
Format vscode extension and add npm run fix
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands/index.ts4
-rw-r--r--editors/code/src/commands/on_enter.ts17
-rw-r--r--editors/code/src/extension.ts21
3 files changed, 28 insertions, 14 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index d78a64c3e43..33e2b34a28c 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -2,7 +2,7 @@ import * as applySourceChange from './apply_source_change';
 import * as extendSelection from './extend_selection';
 import * as joinLines from './join_lines';
 import * as matchingBrace from './matching_brace';
-import * as on_enter from './on_enter';
+import * as onEnter from './on_enter';
 import * as parentModule from './parent_module';
 import * as runnables from './runnables';
 import * as syntaxTree from './syntaxTree';
@@ -15,5 +15,5 @@ export {
     parentModule,
     runnables,
     syntaxTree,
-    on_enter,
+    onEnter
 };
diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts
index 2666797fe71..fe6aca63d97 100644
--- a/editors/code/src/commands/on_enter.ts
+++ b/editors/code/src/commands/on_enter.ts
@@ -1,7 +1,10 @@
 import * as vscode from 'vscode';
 import * as lc from 'vscode-languageclient';
 import { Server } from '../server';
-import { handle as applySourceChange, SourceChange } from './apply_source_change';
+import {
+    handle as applySourceChange,
+    SourceChange
+} from './apply_source_change';
 
 interface OnEnterParams {
     textDocument: lc.TextDocumentIdentifier;
@@ -10,12 +13,18 @@ interface OnEnterParams {
 
 export async function handle(event: { text: string }): Promise<boolean> {
     const editor = vscode.window.activeTextEditor;
-    if (editor == null || editor.document.languageId !== 'rust' || event.text !== '\n') {
+    if (
+        editor == null ||
+        editor.document.languageId !== 'rust' ||
+        event.text !== '\n'
+    ) {
         return false;
     }
     const request: OnEnterParams = {
         textDocument: { uri: editor.document.uri.toString() },
-        position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active),
+        position: Server.client.code2ProtocolConverter.asPosition(
+            editor.selection.active
+        )
     };
     const change = await Server.client.sendRequest<undefined | SourceChange>(
         'm/onEnter',
@@ -25,5 +34,5 @@ export async function handle(event: { text: string }): Promise<boolean> {
         return false;
     }
     await applySourceChange(change);
-    return true
+    return true;
 }
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 3e576753552..ff8f23c7a78 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -16,21 +16,26 @@ export function activate(context: vscode.ExtensionContext) {
         disposeOnDeactivation(vscode.commands.registerCommand(name, f));
     }
     function overrideCommand(
-
         name: string,
-        f: (...args: any[]) => Promise<boolean>,
+        f: (...args: any[]) => Promise<boolean>
     ) {
         const defaultCmd = `default:${name}`;
-        const original = async (...args: any[]) => await vscode.commands.executeCommand(defaultCmd, ...args);
+        const original = async (...args: any[]) =>
+            await vscode.commands.executeCommand(defaultCmd, ...args);
+
         registerCommand(name, async (...args: any[]) => {
             const editor = vscode.window.activeTextEditor;
-            if (!editor || !editor.document || editor.document.languageId !== 'rust') {
+            if (
+                !editor ||
+                !editor.document ||
+                editor.document.languageId !== 'rust'
+            ) {
                 return await original(...args);
             }
-            if (!await f(...args)) {
+            if (!(await f(...args))) {
                 return await original(...args);
             }
-        })
+        });
     }
 
     // Commands are requests from vscode to the language server
@@ -44,12 +49,12 @@ export function activate(context: vscode.ExtensionContext) {
         'ra-lsp.applySourceChange',
         commands.applySourceChange.handle
     );
-    overrideCommand('type', commands.on_enter.handle)
+    overrideCommand('type', commands.onEnter.handle);
 
     // Notifications are events triggered by the language server
     const allNotifications: Iterable<
         [string, lc.GenericNotificationHandler]
-        > = [['m/publishDecorations', notifications.publishDecorations.handle]];
+    > = [['m/publishDecorations', notifications.publishDecorations.handle]];
 
     // The events below are plain old javascript events, triggered and handled by vscode
     vscode.window.onDidChangeActiveTextEditor(