feat: add lua, html/css/json, nix, and oxlint LSPs; add global .git root marker

This commit is contained in:
2026-05-04 06:59:08 -04:00
parent f811efef68
commit 630226a00a
2 changed files with 38 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
import * as fs from "node:fs";
import * as path from "node:path";
import { pathToFileURL, fileURLToPath } from "node:url";
import { servers } from "../server.ts";
import { servers, globalRootMarkers } from "../server.ts";
import type { ServerConfig } from "./types.ts";
import { UnsupportedExtensionError } from "./types.ts";
@@ -31,8 +31,9 @@ export function pickServer(filePath: string): ServerConfig {
export function findRoot(filePath: string, markers: string[]): string {
let dir = path.dirname(path.resolve(filePath));
const { root } = path.parse(dir);
const allMarkers = [...markers, ...globalRootMarkers];
while (true) {
for (const m of markers) {
for (const m of allMarkers) {
if (fs.existsSync(path.join(dir, m))) return dir;
}
if (dir === root) return path.dirname(path.resolve(filePath));