mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-08 12:48:48 +02:00
fix: stabilize TypeScript LSP startup
Seed new TypeScript LSP profiles with --stdio, validate that shared profiles keep the required flag, auto-add it for existing profiles in the sidecar runtime, and include recent stderr when a language server dies before completing a request. Add shared and sidecar regression coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -126,6 +126,11 @@ export function validateLspProfileDefinition(profile: LspProfileDefinition): str
|
||||
return `LSP profile "${profile.name}" needs at least one file extension.`;
|
||||
}
|
||||
|
||||
if (requiresTypeScriptLanguageServerStdio(profile.command)
|
||||
&& !normalizeStringArray(profile.args).some((arg) => arg.toLowerCase() === '--stdio')) {
|
||||
return `LSP profile "${profile.name}" needs the "--stdio" argument.`;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -168,6 +173,18 @@ function normalizeFileExtensions(fileExtensions: string[]): string[] {
|
||||
return normalizeStringArray(fileExtensions).map((value) => (value.startsWith('.') ? value : `.${value}`));
|
||||
}
|
||||
|
||||
function requiresTypeScriptLanguageServerStdio(command: string): boolean {
|
||||
const executableName = command
|
||||
.trim()
|
||||
.split(/[\\/]/)
|
||||
.at(-1)
|
||||
?.toLowerCase();
|
||||
|
||||
return executableName === 'typescript-language-server'
|
||||
|| executableName === 'typescript-language-server.cmd'
|
||||
|| executableName === 'typescript-language-server.exe';
|
||||
}
|
||||
|
||||
function normalizeStringArray(values?: ReadonlyArray<string>): string[] {
|
||||
if (!values) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user