- 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
20 lines
535 B
TypeScript
20 lines
535 B
TypeScript
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;
|
|
}
|