mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-05 15:31:27 +00:00
refactor: improve IDE context format and editor command error handling
- Change IDE context from JSON to plain text format for better LLM comprehension - Remove JSON.stringify() and code fences from getIdeContextParts() - Use human-readable format: 'Active file:', 'Cursor: line X, character Y' - Apply same format to delta updates: 'Files opened:', 'Files closed:', etc. - Update all related tests to match new plain text format - Fix editor command fallback logic in useLaunchEditor - Throw clear error when no editor command is available - Remove meaningless fallback to last command in list - Provide helpful error message with tried commands and solution
This commit is contained in:
parent
87dc618a21
commit
3d059b71de
1 changed files with 9 additions and 3 deletions
|
|
@ -34,11 +34,17 @@ function getExecutableCommand(editorType: EditorType): string {
|
|||
const commands =
|
||||
process.platform === 'win32' ? commandConfig.win32 : commandConfig.default;
|
||||
|
||||
// Try to find the first available command
|
||||
const availableCommand = commands.find((cmd) => commandExists(cmd));
|
||||
|
||||
// Return the first available command, or fall back to the last one in the list
|
||||
return availableCommand || commands[commands.length - 1];
|
||||
if (!availableCommand) {
|
||||
throw new Error(
|
||||
`No available editor command found for ${editorType}. ` +
|
||||
`Tried: ${commands.join(', ')}. ` +
|
||||
`Please install one of these editors or set a different preferredEditor in settings.`,
|
||||
);
|
||||
}
|
||||
|
||||
return availableCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue