refactor(lsp): configure local servers together

This commit is contained in:
Dudu-0223
2026-07-16 17:31:20 +08:00
parent 0d8e7e98f7
commit a63c55eb00
13 changed files with 213 additions and 101 deletions
@@ -46,11 +46,14 @@ describe.skipIf(!built)('built lib real load path (plain node)', () => {
const ctx = new Context()
await ctx.plugin(Lsp)
await ctx.plugin(LspLocal, {
providerId: 'fake',
command: ${JSON.stringify(process.execPath)},
args: ['--import', ${JSON.stringify(tsxLoader)}, ${JSON.stringify(fixtureServer)}],
env: { TSX_TSCONFIG_PATH: ${JSON.stringify(repoTsconfig)}, LSP_FAKE_DEF: ${JSON.stringify(location)} },
extensionToLanguage: { '.ts': 'typescript' },
servers: {
fake: {
command: ${JSON.stringify(process.execPath)},
args: ['--import', ${JSON.stringify(tsxLoader)}, ${JSON.stringify(fixtureServer)}],
env: { TSX_TSCONFIG_PATH: ${JSON.stringify(repoTsconfig)}, LSP_FAKE_DEF: ${JSON.stringify(location)} },
extensionToLanguage: { '.ts': 'typescript' },
},
},
})
const result = await ctx.lsp.query({ operation: 'definition', filePath: 'a.ts', position: { line: 0, character: 6 }, workspaceRoot: ${JSON.stringify(ws)} })
console.log(JSON.stringify(result))