mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
fix: follow review for default context filename handling
This commit is contained in:
parent
0c155768df
commit
d7d2ffb304
5 changed files with 44 additions and 11 deletions
|
|
@ -604,6 +604,35 @@ describe('loadCliConfig', () => {
|
|||
expect(config.getIncludePartialMessages()).toBe(true);
|
||||
});
|
||||
|
||||
it('should reset context filenames to defaults when context.fileName is not configured', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = {};
|
||||
const defaultContextFiles = ['QWEN.md', 'AGENTS.md'];
|
||||
const getAllSpy = vi
|
||||
.spyOn(ServerConfig, 'getAllGeminiMdFilenames')
|
||||
.mockReturnValue(defaultContextFiles);
|
||||
const setFilenameSpy = vi.spyOn(ServerConfig, 'setGeminiMdFilename');
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(getAllSpy).toHaveBeenCalledTimes(1);
|
||||
expect(setFilenameSpy).toHaveBeenCalledWith(defaultContextFiles);
|
||||
});
|
||||
|
||||
it('should use context.fileName from settings when provided', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const argv = await parseArguments();
|
||||
const settings: Settings = { context: { fileName: 'CUSTOM_CONTEXT.md' } };
|
||||
const getAllSpy = vi.spyOn(ServerConfig, 'getAllGeminiMdFilenames');
|
||||
const setFilenameSpy = vi.spyOn(ServerConfig, 'setGeminiMdFilename');
|
||||
|
||||
await loadCliConfig(settings, argv);
|
||||
|
||||
expect(setFilenameSpy).toHaveBeenCalledWith('CUSTOM_CONTEXT.md');
|
||||
expect(getAllSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should initialize native LSP service when enabled', async () => {
|
||||
process.argv = ['node', 'script.js', '--experimental-lsp'];
|
||||
const argv = await parseArguments();
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
import {
|
||||
ApprovalMode,
|
||||
AGENT_CONTEXT_FILENAME,
|
||||
AuthType,
|
||||
Config,
|
||||
DEFAULT_CONTEXT_FILENAME,
|
||||
DEFAULT_QWEN_EMBEDDING_MODEL,
|
||||
FileDiscoveryService,
|
||||
FileEncoding,
|
||||
getAllGeminiMdFilenames,
|
||||
loadServerHierarchicalMemory,
|
||||
setGeminiMdFilename as setServerGeminiMdFilename,
|
||||
resolveTelemetrySettings,
|
||||
|
|
@ -690,10 +689,7 @@ export async function loadCliConfig(
|
|||
setServerGeminiMdFilename(settings.context.fileName);
|
||||
} else {
|
||||
// Reset to default context filenames if not provided in settings.
|
||||
setServerGeminiMdFilename([
|
||||
DEFAULT_CONTEXT_FILENAME,
|
||||
AGENT_CONTEXT_FILENAME,
|
||||
]);
|
||||
setServerGeminiMdFilename(getAllGeminiMdFilenames());
|
||||
}
|
||||
|
||||
// Automatically load output-language.md if it exists
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue