mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-25 17:04:42 +00:00
* feat(lsp): add /lsp slash command to show server status Implements the /lsp command that displays the status of all configured LSP servers. Previously this was documented in the FAQ but never implemented, leaving users with no way to check if their language servers started successfully. Changes: - Add LspServerStatusInfo interface to lsp/types.ts - Add getServerStatus() to LspClient and NativeLspClient - Expose getServerHandles() from NativeLspService - Create lspCommand.ts with status table output - Register /lsp in BuiltinCommandLoader (only when LSP is enabled) The command shows: server name, command, languages, and status (NOT_STARTED / IN_PROGRESS / READY / FAILED + error message). * fix(lsp): expose status and startup diagnostics * fix(lsp): harden status command diagnostics * fix(lsp): add stderr error listener and harden initialization error handling - Add stderr 'error' event listener in LspConnectionFactory to prevent unhandled stream errors from crashing the process - Wrap setLspInitializationError calls in try-catch in config.ts to guard against post-initialization state changes that would throw
85 lines
2.3 KiB
TypeScript
85 lines
2.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { describe, expect, it } from 'vitest';
|
|
import { getSystemInfoFields } from './systemInfoFields.js';
|
|
import type { ExtendedSystemInfo } from './systemInfo.js';
|
|
|
|
describe('getAboutSystemInfoFields', () => {
|
|
it('orders sandbox/proxy after session id', () => {
|
|
const info: ExtendedSystemInfo = {
|
|
cliVersion: '1.0.0',
|
|
osPlatform: 'darwin',
|
|
osArch: 'arm64',
|
|
osRelease: '23.0.0',
|
|
nodeVersion: 'v20.0.0',
|
|
npmVersion: '10.0.0',
|
|
sandboxEnv: 'no sandbox',
|
|
modelVersion: 'test-model',
|
|
selectedAuthType: 'test-auth',
|
|
ideClient: 'test-ide',
|
|
lspStatus: 'enabled, 1/1 ready',
|
|
sessionId: 'test-session-id',
|
|
memoryUsage: '100 MB',
|
|
baseUrl: undefined,
|
|
gitCommit: undefined,
|
|
proxy: 'http://user:pass@localhost:7890',
|
|
};
|
|
|
|
const fields = getSystemInfoFields(info);
|
|
const labels = fields.map((f) => f.label);
|
|
|
|
expect(labels).toEqual([
|
|
'Qwen Code',
|
|
'Runtime',
|
|
'IDE Client',
|
|
'LSP',
|
|
'OS',
|
|
'Auth',
|
|
'Model',
|
|
'Fast Model',
|
|
'Session ID',
|
|
'Sandbox',
|
|
'Proxy',
|
|
'Memory Usage',
|
|
]);
|
|
|
|
expect(labels.indexOf('Session ID')).toBeLessThan(
|
|
labels.indexOf('Sandbox'),
|
|
);
|
|
expect(labels.indexOf('Session ID')).toBeLessThan(labels.indexOf('Proxy'));
|
|
|
|
const lspField = fields.find((f) => f.label === 'LSP');
|
|
expect(lspField?.value).toBe('enabled, 1/1 ready');
|
|
|
|
const proxyField = fields.find((f) => f.label === 'Proxy');
|
|
expect(proxyField?.value).toBe('http://***:***@localhost:7890/');
|
|
});
|
|
|
|
it('always includes Proxy with "no proxy" when unset', () => {
|
|
const info: ExtendedSystemInfo = {
|
|
cliVersion: '1.0.0',
|
|
osPlatform: 'darwin',
|
|
osArch: 'arm64',
|
|
osRelease: '23.0.0',
|
|
nodeVersion: 'v20.0.0',
|
|
npmVersion: '10.0.0',
|
|
sandboxEnv: 'no sandbox',
|
|
modelVersion: 'test-model',
|
|
selectedAuthType: 'test-auth',
|
|
ideClient: 'test-ide',
|
|
sessionId: 'test-session-id',
|
|
memoryUsage: '100 MB',
|
|
baseUrl: undefined,
|
|
gitCommit: undefined,
|
|
proxy: undefined,
|
|
};
|
|
|
|
const fields = getSystemInfoFields(info);
|
|
const proxyField = fields.find((f) => f.label === 'Proxy');
|
|
expect(proxyField?.value).toBe('no proxy');
|
|
});
|
|
});
|