11'use strict' ;
2- // The module 'vscode' contains the VS Code extensibility API
3- // Import the module and reference it with the alias vscode in your code below
2+
43import * as vscode from 'vscode' ;
54import * as path from "path" ;
65import * as net from "net" ;
7- import { LanguageClient , LanguageClientOptions , ServerOptions , StreamInfo } from "vscode-languageclient" ;
86import * as Annotator from "./annotator" ;
97import * as notifications from "./notifications" ;
108import findJava from "./findJava" ;
9+ import { LanguageClient , LanguageClientOptions , ServerOptions , StreamInfo } from "vscode-languageclient" ;
1110import { Proposed } from 'vscode-languageserver-protocol' ;
1211import { AttachDebuggerProvider } from './debugger/AttachDebuggerProvider' ;
1312
1413const LANGUAGE_ID = 'lua' ; //EmmyLua
15- export var savedContext : vscode . ExtensionContext ;
16- var client : LanguageClient ;
17- var activeEditor : vscode . TextEditor ;
18- var progressBar : vscode . StatusBarItem ;
19- var javaExecutablePath : string | null ;
14+ export let savedContext : vscode . ExtensionContext ;
15+ let client : LanguageClient ;
16+ let activeEditor : vscode . TextEditor ;
17+ let progressBar : vscode . StatusBarItem ;
18+ let javaExecutablePath : string | null ;
2019
2120export function activate ( context : vscode . ExtensionContext ) {
2221 console . log ( "emmy lua actived!" ) ;
@@ -32,7 +31,7 @@ export function activate(context: vscode.ExtensionContext) {
3231 vscode . commands . registerCommand ( "emmy.restartServer" , restartServer ) ;
3332 vscode . commands . registerCommand ( "emmy.showReferences" , showReferences ) ;
3433
35- let provder = new AttachDebuggerProvider ( ) ;
34+ const provder = new AttachDebuggerProvider ( ) ;
3635 savedContext . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( "emmylua_attach" , provder ) ) ;
3736 savedContext . subscriptions . push ( vscode . debug . registerDebugConfigurationProvider ( "emmylua_launch" , provder ) ) ;
3837 savedContext . subscriptions . push ( provder ) ;
@@ -46,7 +45,7 @@ function asProtocol(workspaceFolder: vscode.WorkspaceFolder): Proposed.Workspace
4645}
4746
4847function onDidChangeWorkspaceFolders ( event : vscode . WorkspaceFoldersChangeEvent ) {
49- let params : Proposed . DidChangeWorkspaceFoldersParams = {
48+ const params : Proposed . DidChangeWorkspaceFoldersParams = {
5049 event : {
5150 added : event . added . map ( folder => asProtocol ( folder ) ) ,
5251 removed : event . removed . map ( folder => asProtocol ( folder ) )
@@ -92,7 +91,7 @@ function onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) {
9291}
9392
9493function startClient ( ) {
95- let clientOptions : LanguageClientOptions = {
94+ const clientOptions : LanguageClientOptions = {
9695 documentSelector : [ { scheme : 'file' , language : LANGUAGE_ID } ] ,
9796 synchronize : {
9897 configurationSection : LANGUAGE_ID ,
@@ -107,10 +106,10 @@ function startClient() {
107106 } ;
108107
109108 let socketMode = false ;
110- var serverOptions : ServerOptions ;
109+ let serverOptions : ServerOptions ;
111110 if ( socketMode ) {
112111 // The server is a started as a separate app and listens on port 5007
113- let connectionInfo = {
112+ const connectionInfo = {
114113 port : 5007
115114 } ;
116115 serverOptions = ( ) => {
@@ -126,8 +125,8 @@ function startClient() {
126125 return Promise . resolve ( result ) ;
127126 } ;
128127 } else {
129- let cp = path . resolve ( savedContext . extensionPath , "server" , "*" ) ;
130- let exePath = javaExecutablePath || "java" ;
128+ const cp = path . resolve ( savedContext . extensionPath , "server" , "*" ) ;
129+ const exePath = javaExecutablePath || "java" ;
131130 console . log ( 'exe path : ' + exePath ) ;
132131 serverOptions = {
133132 command : exePath ,
@@ -154,7 +153,7 @@ function startClient() {
154153 startClient ( ) ;
155154 } ) ;
156155 } ) ;
157- let disposable = client . start ( ) ;
156+ const disposable = client . start ( ) ;
158157 savedContext . subscriptions . push ( disposable ) ;
159158}
160159
@@ -169,8 +168,8 @@ function restartServer() {
169168}
170169
171170function showReferences ( uri : string , pos : vscode . Position ) {
172- let u = vscode . Uri . parse ( uri ) ;
173- let p = new vscode . Position ( pos . line , pos . character ) ;
171+ const u = vscode . Uri . parse ( uri ) ;
172+ const p = new vscode . Position ( pos . line , pos . character ) ;
174173 vscode . commands . executeCommand ( "vscode.executeReferenceProvider" , u , p ) . then ( locations => {
175174 vscode . commands . executeCommand ( "editor.action.showReferences" , u , p , locations ) ;
176175 } ) ;
0 commit comments