mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Minor UX updates for IDE mode (#4311)
This commit is contained in:
@@ -122,4 +122,19 @@ describe('ideContext - Active File', () => {
|
||||
const activeFile = ideContext.getActiveFileContext();
|
||||
expect(activeFile).toEqual(testFile);
|
||||
});
|
||||
|
||||
it('should clear the active file context', () => {
|
||||
const testFile = {
|
||||
filePath: '/path/to/test/file.ts',
|
||||
cursor: { line: 5, character: 10 },
|
||||
};
|
||||
|
||||
ideContext.setActiveFileContext(testFile);
|
||||
|
||||
expect(ideContext.getActiveFileContext()).toEqual(testFile);
|
||||
|
||||
ideContext.clearActiveFileContext();
|
||||
|
||||
expect(ideContext.getActiveFileContext()).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,6 +68,14 @@ export function createIdeContextStore() {
|
||||
notifySubscribers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the active file context and notifies all registered subscribers of the change.
|
||||
*/
|
||||
function clearActiveFileContext(): void {
|
||||
activeFileContext = undefined;
|
||||
notifySubscribers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current active file context.
|
||||
* @returns The `ActiveFile` object if a file is active, otherwise `undefined`.
|
||||
@@ -96,6 +104,7 @@ export function createIdeContextStore() {
|
||||
setActiveFileContext,
|
||||
getActiveFileContext,
|
||||
subscribeToActiveFile,
|
||||
clearActiveFileContext,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -215,6 +215,9 @@ export async function connectAndDiscover(
|
||||
mcpClient.onerror = (error) => {
|
||||
console.error(`MCP ERROR (${mcpServerName}):`, error.toString());
|
||||
updateMCPServerStatus(mcpServerName, MCPServerStatus.DISCONNECTED);
|
||||
if (mcpServerName === IDE_SERVER_NAME) {
|
||||
ideContext.clearActiveFileContext();
|
||||
}
|
||||
};
|
||||
|
||||
if (mcpServerName === IDE_SERVER_NAME) {
|
||||
|
||||
Reference in New Issue
Block a user