Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion language-server/src/core/workspace-indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,13 +1161,34 @@ export class WorkspaceIndexer {
this.resolveGitCheck(filePath, isIgnored);
}
} catch (error) {
console.error(`Git check-ignore batch failed for ${folder}:`, error);
const exitCode = WorkspaceIndexer.getGitExitCode(error);
if (exitCode !== 1) {
console.error(`Git check-ignore batch failed for ${folder}:`, error);
}
for (const filePath of filesArray) {
this.resolveGitCheck(filePath, false);
}
}
}

private static getGitExitCode(error: unknown): number | undefined {
if (typeof error === 'object' && error !== null && 'code' in error) {
const code = (error as { code?: unknown }).code;
if (typeof code === 'number') {
return code;
}
}

if (error instanceof Error) {
const match = error.message.match(/code\s+(\d+)/);
if (match) {
return Number.parseInt(match[1], 10);
}
}

return undefined;
}

private resolveGitCheck(filePath: string, isIgnored: boolean) {
const resolvers = this.gitCheckResolvers.get(filePath);
if (resolvers) {
Expand Down