Skip to content

The agent that grows with you

fix(lsp): Vue reinstall hint routes through `hermes lsp install`; recipe test is a major-bound invariant

teknium1d0db722786da
diff --git a/agent/lsp/servers.py b/agent/lsp/servers.py
index ad9a7292353..9fd9a29da44 100644
--- a/agent/lsp/servers.py
+++ b/agent/lsp/servers.py
@@ -192,14 +192,17 @@ def _spawn_bash_ls(root: str, ctx: ServerContext) -> Optional[SpawnSpec]:
return _make_spec(root, ctx, "bash-language-server", [bin_path, "start"])
+_VUE_REINSTALL = (
+ "delete <HERMES_HOME>/lsp/node_modules/@vue and <HERMES_HOME>/lsp/bin/vue-language-server*, "
+ "then run: hermes lsp install vue-language-server"
+)
_VUE_TUNNEL_MSG = (
"vue-language-server: the installed @vue/language-server is 3.x, which only works behind a client-hosted "
- "tsserver tunnel Hermes does not run — no diagnostics will arrive. Reinstall the self-hosting 2.x line: "
- "npm install --prefix <HERMES_HOME>/lsp @vue/language-server@2 typescript@6"
+ f"tsserver tunnel Hermes does not run — no diagnostics will arrive. Reinstall the self-hosting 2.x line: {_VUE_REINSTALL}"
)
_VUE_TSDK_MSG = (
"vue-language-server: no JavaScript TypeScript SDK (typescript/lib/typescript.js) next to the server or under "
- "the project's node_modules — diagnostics are skipped. Install one: npm install --prefix <HERMES_HOME>/lsp typescript@6"
+ f"the project's node_modules — diagnostics are skipped. Reinstall (the recipe co-installs one): {_VUE_REINSTALL}"
)
diff --git a/tests/agent/lsp/test_vue_server.py b/tests/agent/lsp/test_vue_server.py
index 6a977f949ad..dc7e58fa0d7 100644
--- a/tests/agent/lsp/test_vue_server.py
+++ b/tests/agent/lsp/test_vue_server.py
@@ -12,7 +12,6 @@ import os
import pytest
-from agent.lsp.install import INSTALL_RECIPES, TYPESCRIPT_SDK_PKG
from agent.lsp.servers import ServerContext, find_server_for_file
@@ -56,9 +55,16 @@ def test_vue_spawns_only_a_self_hosting_server_with_a_js_typescript_sdk(tmp_path
def test_js_toolchain_recipes_pin_a_javascript_typescript_sdk():
- """Both TypeScript-hosting recipes co-install the same JS-based TypeScript line (7+ is the Go port with no
- ``tsserver.js``), and the Vue recipe stays on the self-hosting 2.x major."""
+ """Both TypeScript-hosting recipes co-install a JS-based TypeScript line (7+ is the Go port with no
+ ``tsserver.js``), and the Vue recipe stays below the tunnel-only 3.x major."""
+ from agent.lsp.install import INSTALL_RECIPES
+
+ def major(spec: str, name: str) -> int:
+ assert spec.startswith(f"{name}@"), spec # unpinned = floats onto the next major
+ return int(spec[len(name) + 1:].split(".")[0])
+
vue, tsls = INSTALL_RECIPES["@vue/language-server"], INSTALL_RECIPES["typescript-language-server"]
- assert vue["pkg"] == "@vue/language-server@2"
- assert TYPESCRIPT_SDK_PKG in vue["extra_pkgs"] and TYPESCRIPT_SDK_PKG in tsls["extra_pkgs"]
- assert TYPESCRIPT_SDK_PKG.startswith("typescript@") and int(TYPESCRIPT_SDK_PKG.split("@")[1].split(".")[0]) < 7
+ assert major(vue["pkg"], "@vue/language-server") < 3
+ for recipe in (vue, tsls):
+ sdk = [p for p in recipe.get("extra_pkgs") or [] if p.split("@")[0] == "typescript"]
+ assert sdk and major(sdk[0], "typescript") < 7
diff --git a/website/docs/user-guide/features/lsp.md b/website/docs/user-guide/features/lsp.md
index 2eba236179b..1fdca90ba25 100644
--- a/website/docs/user-guide/features/lsp.md
+++ b/website/docs/user-guide/features/lsp.md
@@ -128,8 +128,10 @@ Vue is pinned to `@vue/language-server@2`, started with
line only works behind a client-hosted `tsserver` tunnel (the VS Code /
Neovim setup) that Hermes's generic client does not run, so it never
publishes diagnostics. If an earlier Hermes installed 3.x, the log shows a
-one-time `vue-language-server: ... 3.x` warning; reinstall with
-`npm install --prefix <HERMES_HOME>/lsp @vue/language-server@2 typescript@6`.
+one-time `vue-language-server: ... 3.x` warning; delete
+`<HERMES_HOME>/lsp/node_modules/@vue` and `<HERMES_HOME>/lsp/bin/vue-language-server*`,
+then run `hermes lsp install vue-language-server` (the recipe co-installs the
+TypeScript SDK).
## CLI