diff --git a/LSP-javascript.sublime-settings b/LSP-javascript.sublime-settings deleted file mode 100644 index e1ff136..0000000 --- a/LSP-javascript.sublime-settings +++ /dev/null @@ -1,21 +0,0 @@ -{ - "client" : { - "enabled": true, - "languages": [ - { - "languageId": "javascript", - "scopes": [ - "source.js", - "source.jsx" - ], - "syntaxes": [ - "Packages/User/JS Custom/Syntaxes/React.sublime-syntax", - "Packages/JavaScript/JavaScript.sublime-syntax", - "Packages/Babel/JavaScript (Babel).sublime-syntax" - ] - } - ], - "initializationOptions": {}, - "settings": {} - } -} diff --git a/LSP-typescript.sublime-settings b/LSP-typescript.sublime-settings index 5f055a7..b897cef 100644 --- a/LSP-typescript.sublime-settings +++ b/LSP-typescript.sublime-settings @@ -5,10 +5,15 @@ { "languageId": "typescript", "scopes": [ + "source.js", + "source.jsx", "source.ts", "source.tsx" ], "syntaxes": [ + "Packages/User/JS Custom/Syntaxes/React.sublime-syntax", + "Packages/JavaScript/JavaScript.sublime-syntax", + "Packages/Babel/JavaScript (Babel).sublime-syntax", "Packages/TypeScript Syntax/TypeScript.tmLanguage", "Packages/TypeScript Syntax/TypeScriptReact.tmLanguage", "Packages/User/TypeScriptReactGraphQL.sublime-syntax" diff --git a/plugin.py b/plugin.py index c1d69b2..a0117ce 100644 --- a/plugin.py +++ b/plugin.py @@ -17,14 +17,6 @@ 'cli.js' ) -ts_server_path = os.path.join( - package_path, - 'node_modules', - 'typescript', - 'bin', - 'tsserver' -) - eslint_path = os.path.join( package_path, 'node_modules', @@ -99,22 +91,22 @@ def config(self) -> ClientConfig: default_configuration = { "command": [ - 'node', - server_path, - '--stdio', - '--tsserver-path', - ts_server_path, - '--tsserver-log-verbosity', - 'verbose' + "typescript-language-server", + '--stdio' ], "languages": [ { "languageId": "typescript", "scopes": [ + "source.js", + "source.jsx", "source.ts", "source.tsx" ], "syntaxes": [ + "Packages/User/JS Custom/Syntaxes/React.sublime-syntax", + "Packages/JavaScript/JavaScript.sublime-syntax", + "Packages/Babel/JavaScript (Babel).sublime-syntax", "Packages/TypeScript Syntax/TypeScript.tmLanguage", "Packages/TypeScript Syntax/TypeScriptReact.tmLanguage", "Packages/User/TypeScriptReactGraphQL.sublime-syntax" @@ -140,62 +132,5 @@ def on_start(self, window) -> bool: return False return True - def on_initialized(self, client) -> None: - pass # extra initialization here. - - -class LspJavaScriptPlugin(LanguageHandler): - @property - def name(self) -> str: - return 'lsp-javascript' - - @property - def config(self) -> ClientConfig: - settings = sublime.load_settings("LSP-javascript.sublime-settings") - client_configuration = settings.get('client') - - default_configuration = { - "command": [ - 'node', - server_path, - '--stdio', - '--tsserver-path', - ts_server_path, - '--tsserver-log-verbosity', - 'verbose' - ], - "languages": [ - { - "languageId": "JavaScript", - "scopes": [ - "source.js", - "source.jsx" - ], - "syntaxes": [ - "Packages/User/JS Custom/Syntaxes/React.sublime-syntax", - "Packages/JavaScript/JavaScript.sublime-syntax", - "Packages/Babel/JavaScript (Babel).sublime-syntax" - ] - } - ], - "initializationOptions": { - # "plugins": [ - # { - # "name": "typescript-eslint-language-service", - # "location": eslint_path - # } - # ] - } - } - - default_configuration.update(client_configuration) - return read_client_config('lsp-javascript', default_configuration) - - def on_start(self, window) -> bool: - if not is_node_installed(): - sublime.status_message('Please install Node.js for the TypeScript Language Server to work.') - return False - return True - def on_initialized(self, client) -> None: pass # extra initialization here. \ No newline at end of file