feat(coder): add LSP code intelligence tools
- lsp/ module: types, config, JSON-RPC client, server-manager, operations - lsp_diagnostics: TypeScript/JavaScript diagnostics for a file - lsp_goto_definition: find symbol definition at position - lsp_find_references: find all references to a symbol - Registered as READ_TOOLS in tool index
This commit is contained in:
19
apps/coder/src/services/lsp/config.ts
Normal file
19
apps/coder/src/services/lsp/config.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface LspServerConfig {
|
||||
command: string;
|
||||
args: string[];
|
||||
rootPatterns: string[];
|
||||
}
|
||||
|
||||
const TS_CONFIG: LspServerConfig = {
|
||||
command: 'typescript-language-server',
|
||||
args: ['--stdio'],
|
||||
rootPatterns: ['package.json', 'tsconfig.json'],
|
||||
};
|
||||
|
||||
const SUPPORTED_EXTS = new Set(['ts', 'tsx', 'js', 'jsx', 'mjs', 'cjs']);
|
||||
|
||||
export function getServerConfig(filePath: string): LspServerConfig | null {
|
||||
const ext = filePath.split('.').pop()?.toLowerCase();
|
||||
if (ext && SUPPORTED_EXTS.has(ext)) return TS_CONFIG;
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user