Skip to content

Commit

Permalink
Fix windows not installing node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
predrag-codetribe committed Aug 3, 2019
1 parent 69e0b8f commit 8d88016
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 36 deletions.
41 changes: 11 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
from LSP.plugin.core.settings import ClientConfig, LanguageConfig


package_path = os.path.dirname(__file__)
server_path = os.path.join(package_path, 'node_modules', 'vue-language-server', 'bin', 'vls')


def plugin_loaded():
package_path = os.path.join(sublime.packages_path(), 'LSP-vue')
server_path = os.path.join(package_path, 'node_modules', 'vue-language-server', 'bin', 'vls')
print('LSP-vue: Server {} installed.'.format('is' if os.path.isfile(server_path) else 'is not' ))

# install the node_modules if not installed
Expand All @@ -22,7 +24,7 @@ def plugin_loaded():

runCommand(
onCommandDone,
["npm", "install", "--verbose", "--prefix", package_path]
["npm", "install", "--verbose", "--prefix", package_path, package_path]
)


Expand All @@ -39,7 +41,10 @@ def runCommand(onExit, popenArgs):
"""
def runInThread(onExit, popenArgs):
try:
subprocess.check_call(popenArgs)
if sublime.platform() == 'windows':
subprocess.check_call(popenArgs, shell=True)
else:
subprocess.check_call(popenArgs)
onExit()
except subprocess.CalledProcessError as error:
logAndShowMessage('LSP-vue: Error while installing the server.', error)
Expand All @@ -66,8 +71,6 @@ def name(self) -> str:

@property
def config(self) -> ClientConfig:
package_path = os.path.join(sublime.packages_path(), 'LSP-vue')
server_path = os.path.join(package_path, 'node_modules', 'vue-language-server', 'bin', 'vls')
settings = sublime.load_settings("LSP-vue.sublime-settings")
return ClientConfig(
name='lsp-vue',
Expand Down

0 comments on commit 8d88016

Please sign in to comment.