@@ -6,7 +6,7 @@ import { promisify } from "util";
66import { ExtensionContext , commands , window , workspace } from "vscode" ;
77import { LanguageClient , ServerOptions } from "vscode-languageclient/node" ;
88
9- import * as variables from ' ./variables' ;
9+ import * as variables from " ./variables" ;
1010import Visualize from "./Visualize" ;
1111
1212const promiseExec = promisify ( exec ) ;
@@ -92,7 +92,7 @@ export async function activate(context: ExtensionContext) {
9292 }
9393
9494 // Configure print width.
95- args . push ( `--print-width=${ config . get < number > ( "printWidth" ) } ` )
95+ args . push ( `--print-width=${ config . get < number > ( "printWidth" ) } ` ) ;
9696
9797 // There's a bit of complexity here. Basically, we try to locate
9898 // an stree executable in three places, in order of preference:
@@ -108,7 +108,7 @@ export async function activate(context: ExtensionContext) {
108108 // Explicit path varies between machines/users and is also victim to the
109109 // oversimplification problem.
110110 let run : ServerOptions = { command : "stree" , args } ;
111- let commandPath = advancedConfig . get < string > ( ' commandPath' ) ;
111+ let commandPath = advancedConfig . get < string > ( " commandPath" ) ;
112112 if ( commandPath ) {
113113 commandPath = variables . substitute ( commandPath ) ;
114114 try {
@@ -128,7 +128,7 @@ export async function activate(context: ExtensionContext) {
128128 }
129129 }
130130
131- outputChannel . appendLine ( `Starting language server: ${ run . command } ${ run . args ?. join ( ' ' ) } ` ) ;
131+ outputChannel . appendLine ( `Starting language server: ${ run . command } ${ run . args ?. join ( " " ) } ` ) ;
132132
133133 // Here, we instantiate the language client. This is the object that is
134134 // responsible for the communication and management of the Ruby subprocess.
@@ -147,26 +147,26 @@ export async function activate(context: ExtensionContext) {
147147 // add the various features to the extension. Each of them in turn
148148 // implements Disposable so that they clean up their own resources.
149149 visualizer = new Visualize ( languageClient , outputChannel ) ;
150- context . subscriptions . push (
151- visualizer
152- ) ;
153- } catch ( e : any ) {
150+ context . subscriptions . push ( visualizer ) ;
151+ } catch ( error ) {
154152 languageClient = null ;
155- const items = [ 'Restart' ]
156- let msg = 'Something went wrong.' ;
157- if ( typeof e === 'string' ) {
158- if ( / E N O E N T / . test ( e ) ) {
159- msg = 'Command not found. Is the syntax_tree RubyGem installed?' ;
160- items . unshift ( 'Install Gem' ) ;
153+
154+ const items = [ "Restart" ] ;
155+ let msg = "Something went wrong." ;
156+
157+ if ( typeof error === "string" ) {
158+ if ( / E N O E N T / . test ( error ) ) {
159+ msg = "Command not found. Is the syntax_tree gem installed?" ;
160+ items . unshift ( "Install Gem" ) ;
161161 }
162162 }
163163
164164 const action = await window . showErrorMessage ( msg , ...items ) ;
165165 switch ( action ) {
166- case ' Install Gem' :
166+ case " Install Gem" :
167167 installGem ( ) ;
168168 break ;
169- case ' Restart' :
169+ case " Restart" :
170170 startLanguageServer ( ) ;
171171 break ;
172172 }
@@ -196,12 +196,11 @@ export async function activate(context: ExtensionContext) {
196196 // This function is called when the user wants to recover from ENOENT
197197 // on start. It starts the language server afterward.
198198 async function installGem ( ) {
199- const cwd = getCWD ( ) ;
200199 try {
201- await promiseExec ( "gem install syntax_tree" , { cwd } ) ;
200+ await promiseExec ( "gem install syntax_tree" , { cwd : getCWD ( ) } ) ;
202201 startLanguageServer ( ) ;
203- } catch ( e ) {
204- outputChannel . appendLine ( " Error installing gem: " + e ) ;
202+ } catch ( error ) {
203+ outputChannel . appendLine ( ` Error installing gem: ${ error } ` ) ;
205204 }
206205 }
207206
0 commit comments