88from LSP .plugin .core .settings import ClientConfig , LanguageConfig
99
1010
11+ package_path = os .path .dirname (__file__ )
12+ server_path = os .path .join (package_path , 'node_modules' , 'vue-language-server' , 'bin' , 'vls' )
13+
14+
1115def plugin_loaded ():
12- package_path = os .path .join (sublime .packages_path (), 'LSP-vue' )
13- server_path = os .path .join (package_path , 'node_modules' , 'vue-language-server' , 'bin' , 'vls' )
1416 print ('LSP-vue: Server {} installed.' .format ('is' if os .path .isfile (server_path ) else 'is not' ))
1517
1618 # install the node_modules if not installed
@@ -22,7 +24,7 @@ def plugin_loaded():
2224
2325 runCommand (
2426 onCommandDone ,
25- ["npm" , "install" , "--verbose" , "--prefix" , package_path ]
27+ ["npm" , "install" , "--verbose" , "--prefix" , package_path , package_path ]
2628 )
2729
2830
@@ -39,7 +41,10 @@ def runCommand(onExit, popenArgs):
3941 """
4042 def runInThread (onExit , popenArgs ):
4143 try :
42- subprocess .check_call (popenArgs )
44+ if sublime .platform () == 'windows' :
45+ subprocess .check_call (popenArgs , shell = True )
46+ else :
47+ subprocess .check_call (popenArgs )
4348 onExit ()
4449 except subprocess .CalledProcessError as error :
4550 logAndShowMessage ('LSP-vue: Error while installing the server.' , error )
@@ -66,8 +71,6 @@ def name(self) -> str:
6671
6772 @property
6873 def config (self ) -> ClientConfig :
69- package_path = os .path .join (sublime .packages_path (), 'LSP-vue' )
70- server_path = os .path .join (package_path , 'node_modules' , 'vue-language-server' , 'bin' , 'vls' )
7174 settings = sublime .load_settings ("LSP-vue.sublime-settings" )
7275 return ClientConfig (
7376 name = 'lsp-vue' ,
0 commit comments