diff --git a/eslint.config.js b/eslint.config.js index ea3158688..e26608f07 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -169,6 +169,7 @@ export default tseslint.config( ...vitest.configs.recommended.rules, 'vitest/expect-expect': 'off', 'vitest/no-commented-out-tests': 'off', + 'no-console': 'off', // Allow console in tests '@typescript-eslint/no-unused-vars': [ 'error', { @@ -190,6 +191,7 @@ export default tseslint.config( }, }, rules: { + 'no-console': 'off', // Allow console in scripts '@typescript-eslint/no-unused-vars': [ 'error', { diff --git a/packages/core/src/lsp/LspConfigLoader.ts b/packages/core/src/lsp/LspConfigLoader.ts index b091a957a..61ffad8b5 100644 --- a/packages/core/src/lsp/LspConfigLoader.ts +++ b/packages/core/src/lsp/LspConfigLoader.ts @@ -17,6 +17,9 @@ import type { LspServerConfig, LspSocketOptions, } from './types.js'; +import { createDebugLogger } from '../utils/debugLogger.js'; + +const debugLogger = createDebugLogger('LSP'); export class LspConfigLoader { constructor(private readonly workspaceRoot: string) {} @@ -36,7 +39,7 @@ export class LspConfigLoader { const data = JSON.parse(configContent); return this.parseConfigSource(data, lspConfigPath); } catch (error) { - console.warn('Failed to load user .lsp.json config:', error); + debugLogger.warn('Failed to load user .lsp.json config:', error); return []; } } @@ -62,7 +65,9 @@ export class LspConfigLoader { lspServers, ); if (!fs.existsSync(configPath)) { - console.warn(`LSP config not found for ${originBase}: ${configPath}`); + debugLogger.warn( + `LSP config not found for ${originBase}: ${configPath}`, + ); continue; } @@ -77,7 +82,7 @@ export class LspConfigLoader { ), ); } catch (error) { - console.warn( + debugLogger.warn( `Failed to load extension LSP config from ${configPath}:`, error, ); @@ -91,7 +96,7 @@ export class LspConfigLoader { ...this.parseConfigSource(hydrated, `${originBase} (lspServers)`), ); } else { - console.warn( + debugLogger.warn( `LSP config for ${originBase} must be an object or a JSON file path.`, ); } @@ -316,12 +321,14 @@ export class LspConfigLoader { const socket = this.normalizeSocketOptions(spec); if (transport === 'stdio' && !command) { - console.warn(`LSP config error in ${origin}: ${name} missing command`); + debugLogger.warn( + `LSP config error in ${origin}: ${name} missing command`, + ); return null; } if (transport !== 'stdio' && !socket) { - console.warn( + debugLogger.warn( `LSP config error in ${origin}: ${name} missing socket info`, ); return null; @@ -485,7 +492,7 @@ export class LspConfigLoader { return resolved; } - console.warn( + debugLogger.warn( `LSP workspaceFolder must be within ${this.workspaceRoot}; using workspace root instead.`, ); return this.workspaceRoot; diff --git a/packages/core/src/lsp/LspConnectionFactory.ts b/packages/core/src/lsp/LspConnectionFactory.ts index dfcecd86d..e6f59718a 100644 --- a/packages/core/src/lsp/LspConnectionFactory.ts +++ b/packages/core/src/lsp/LspConnectionFactory.ts @@ -8,6 +8,9 @@ import * as cp from 'node:child_process'; import * as net from 'node:net'; import { DEFAULT_LSP_REQUEST_TIMEOUT_MS } from './constants.js'; import type { JsonRpcMessage } from './types.js'; +import { createDebugLogger } from '../utils/debugLogger.js'; + +const debugLogger = createDebugLogger('LSP'); interface PendingRequest { resolve: (value: unknown) => void; @@ -375,7 +378,7 @@ export class LspConnectionFactory { try { await lspConnection.connection.shutdown(); } catch (e) { - console.warn('LSP shutdown failed:', e); + debugLogger.warn('LSP shutdown failed:', e); } finally { lspConnection.connection.end(); }