diff --git a/package-lock.json b/package-lock.json index 9fbce79..a819781 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1437,8 +1437,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -1456,13 +1455,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1475,18 +1472,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -1589,8 +1583,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -1600,7 +1593,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1613,20 +1605,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -1643,7 +1632,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -1716,8 +1704,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -1727,7 +1714,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -1803,8 +1789,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -1834,7 +1819,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -1852,7 +1836,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -1891,13 +1874,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } }, diff --git a/plugin.py b/plugin.py index b104028..af63d50 100644 --- a/plugin.py +++ b/plugin.py @@ -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 @@ -22,7 +24,7 @@ def plugin_loaded(): runCommand( onCommandDone, - ["npm", "install", "--verbose", "--prefix", package_path] + ["npm", "install", "--verbose", "--prefix", package_path, package_path] ) @@ -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) @@ -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',