Skip to content

Commit 8d88016

Browse files
Fix windows not installing node_modules
1 parent 69e0b8f commit 8d88016

File tree

2 files changed

+20
-36
lines changed

2 files changed

+20
-36
lines changed

package-lock.json

Lines changed: 11 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
from 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+
1115
def 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

Comments
 (0)