Skip to content

Commit

Permalink
Only use one configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
predragnikolic committed Oct 22, 2019
1 parent 889526c commit 57e7df3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 93 deletions.
21 changes: 0 additions & 21 deletions LSP-javascript.sublime-settings

This file was deleted.

5 changes: 5 additions & 0 deletions LSP-typescript.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
79 changes: 7 additions & 72 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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"
Expand All @@ -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.

0 comments on commit 57e7df3

Please sign in to comment.