summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-10-09 04:21:51 -0400
committerDax Raad <[email protected]>2025-10-09 04:22:38 -0400
commitc0bd29155d6397af60a7a23bd357a1b6b3417734 (patch)
tree53f1fda327d2f3907e4b055207ce00e85be89a2b
parentc5b5795636c16574c1b9d7bc8529c77a2e41db08 (diff)
downloadopencode-c0bd29155d6397af60a7a23bd357a1b6b3417734.tar.gz
opencode-c0bd29155d6397af60a7a23bd357a1b6b3417734.zip
lsp: simplify language server root detection to use lock files
Improves project boundary detection by focusing on package manager lock files instead of config files, providing more reliable workspace identification across different project types.
-rw-r--r--packages/opencode/src/lsp/server.ts46
1 files changed, 4 insertions, 42 deletions
diff --git a/packages/opencode/src/lsp/server.ts b/packages/opencode/src/lsp/server.ts
index c680c2896..591910236 100644
--- a/packages/opencode/src/lsp/server.ts
+++ b/packages/opencode/src/lsp/server.ts
@@ -44,7 +44,7 @@ export namespace LSPServer {
export const Typescript: Info = {
id: "typescript",
- root: NearestRoot(["tsconfig.json", "package.json", "jsconfig.json"]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"],
async spawn(root) {
const tsserver = await Bun.resolve("typescript/lib/tsserver.js", Instance.directory).catch(() => {})
@@ -70,20 +70,7 @@ export namespace LSPServer {
export const Vue: Info = {
id: "vue",
extensions: [".vue"],
- root: NearestRoot([
- "tsconfig.json",
- "jsconfig.json",
- "package.json",
- "pnpm-lock.yaml",
- "yarn.lock",
- "bun.lockb",
- "bun.lock",
- "vite.config.ts",
- "vite.config.js",
- "nuxt.config.ts",
- "nuxt.config.js",
- "vue.config.js",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
async spawn(root) {
let binary = Bun.which("vue-language-server")
const args: string[] = []
@@ -131,20 +118,7 @@ export namespace LSPServer {
export const ESLint: Info = {
id: "eslint",
- root: NearestRoot([
- "eslint.config.js",
- "eslint.config.mjs",
- "eslint.config.cjs",
- "eslint.config.ts",
- "eslint.config.mts",
- "eslint.config.cts",
- ".eslintrc.js",
- ".eslintrc.cjs",
- ".eslintrc.yaml",
- ".eslintrc.yml",
- ".eslintrc.json",
- "package.json",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue"],
async spawn(root) {
const eslint = await Bun.resolve("eslint", Instance.directory).catch(() => {})
@@ -659,19 +633,7 @@ export namespace LSPServer {
export const Svelte: Info = {
id: "svelte",
extensions: [".svelte"],
- root: NearestRoot([
- "tsconfig.json",
- "jsconfig.json",
- "package.json",
- "pnpm-lock.yaml",
- "yarn.lock",
- "bun.lockb",
- "bun.lock",
- "vite.config.ts",
- "vite.config.js",
- "svelte.config.ts",
- "svelte.config.js",
- ]),
+ root: NearestRoot(["package-lock.json", "bun.lockb", "bun.lock", "pnpm-lock.yaml", "yarn.lock"]),
async spawn(root) {
let binary = Bun.which("svelteserver")
const args: string[] = []