Gate debug logs behind TYPESPEC_DEBUG environment variable with custom implementation#9396
Draft
Gate debug logs behind TYPESPEC_DEBUG environment variable with custom implementation#9396
Conversation
…ug logs Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix LSP spamming irrelevant debug messages
Gate compilation config debug logs behind ENABLE_COMPILE_CONFIG_LOGGING
Jan 16, 2026
RodgeFu
reviewed
Jan 17, 2026
Changed from individual ENABLE_*_LOGGING environment variables to Node.js style DEBUG pattern supporting comma-separated areas and wildcards. Usage examples: DEBUG=typespec:compile DEBUG=typespec:* DEBUG=typespec:compile,typespec:config Debug areas: - typespec:compile (previously ENABLE_SERVER_COMPILE_LOGGING) - typespec:update (previously ENABLE_UPDATE_MANAGER_LOGGING) - typespec:config (previously ENABLE_COMPILE_CONFIG_LOGGING) Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Copilot
AI
changed the title
Gate compilation config debug logs behind ENABLE_COMPILE_CONFIG_LOGGING
Gate debug logs behind DEBUG environment variable using Node.js pattern
Jan 17, 2026
RodgeFu
reviewed
Jan 17, 2026
RodgeFu
reviewed
Jan 17, 2026
RodgeFu
reviewed
Jan 17, 2026
Changed debug area names to preserve the original convention: - typespec:server_compile (was typespec:compile) - typespec:update_manager (was typespec:update) - typespec:compile_config (was typespec:config) This maintains consistency with the original ENABLE_*_LOGGING variable names. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
- Added `debug` package (v4.4.0) as dependency - Added `@types/debug` as dev dependency - Replaced custom isDebugEnabled() with debug package loggers - Updated .vscode/launch.json to document DEBUG env var usage - Removed old ENABLE_*_LOGGING environment variable comments The debug package provides standard Node.js debugging with namespace support, wildcards, and better performance than the custom implementation. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Copilot
AI
changed the title
Gate debug logs behind DEBUG environment variable using Node.js pattern
Gate debug logs behind DEBUG environment variable using Jan 17, 2026
debug npm package
RodgeFu
reviewed
Jan 19, 2026
Added a comment to clarify that ENABLE_LM_LOGGING is separate from the DEBUG environment variable logging system and is used specifically for Language Model logging in the typespec-vscode extension. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
RodgeFu
reviewed
Jan 21, 2026
The logCompileConfig function was no longer used after reverting tspconfig completion to use the regular log function. Removed the orphaned function to clean up the code. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Contributor
|
@copilot , resolve confliction and make sure ci can pass |
- Reordered imports in constants.ts (prettier requirement) - Removed trailing whitespace in comments - Updated ThirdPartyNotices.txt with debug package attribution All formatting now passes prettier checks. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Contributor
Author
Code formatting issues resolved in commit 21ba492. Changes:
Ready for CI validation. |
RodgeFu
reviewed
Jan 23, 2026
| "@types/debug": "~4.1.12" | ||
| }, | ||
| "dependencies": { | ||
| "debug": "~4.4.0" |
Contributor
|
@copilot , there is confliction needs to resolve from main branch |
The debug package is only used during development/build time for the VSCode extension, not at runtime, so it should be in devDependencies rather than dependencies. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Contributor
Author
Merge conflicts resolved in commit 1c39832. Conflicts resolved:
All tests passing after merge (entrypoint-resolver: 5/5, tspconfig completion: 118/118). |
1c39832 to
856eeb0
Compare
Contributor
|
@copilot ,
|
…EBUG - Removed debug package dependency from @typespec/compiler and typespec-vscode - Removed @types/debug from both packages - Implemented custom isDebugEnabled() function in constants.ts - Implemented custom isDebugEnabled() function in typespec-vscode const.ts - Changed environment variable from DEBUG to TYPESPEC_DEBUG - Updated .vscode/launch.json to use TYPESPEC_DEBUG The DEBUG environment variable is not supported in VSCode, so using TYPESPEC_DEBUG with a simple custom implementation instead. Co-authored-by: RodgeFu <6038235+RodgeFu@users.noreply.github.com>
Contributor
Author
Changes completed in commit 9757eaf.
All tests passing (entrypoint-resolver: 5/5, tspconfig completion: 118/118). |
Copilot
AI
changed the title
Gate debug logs behind DEBUG environment variable using
Gate debug logs behind TYPESPEC_DEBUG environment variable with custom implementation
Feb 5, 2026
debug npm package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue of LSP spamming irrelevant debug messages in the console on every compilation (which happens on nearly every keystroke with debounce).
Changes Made
Implemented custom debug logging with TYPESPEC_DEBUG environment variable:
isDebugEnabled()function in both@typespec/compilerandtypespec-vscodeDEBUGtoTYPESPEC_DEBUG(sinceDEBUGis not supported in VSCode)Debug areas defined (preserving original naming):
typespec:server_compile- Server compilation debug logs (previouslyENABLE_SERVER_COMPILE_LOGGING)typespec:update_manager- Update manager debug logs (previouslyENABLE_UPDATE_MANAGER_LOGGING)typespec:compile_config- Compilation config debug logs (previouslyENABLE_COMPILE_CONFIG_LOGGING)typespec:lm- Language Model debug logs (previouslyENABLE_LM_LOGGING)Updated files in @typespec/compiler:
constants.ts- Implements customisDebugEnabled(), exportsdebugLoggersentrypoint-resolver.ts- UsesdebugLoggers.compileConfig.enabledcompile-service.ts- UsesdebugLoggers.compileConfig.enabledserver-compile-manager.ts- UsesdebugLoggers.serverCompile.enabledupdate-manager.ts- UsesdebugLoggers.updateManager.enabledserverlib.ts- Uses regularlogfunctionUpdated files in typespec-vscode:
const.ts- Implements customisDebugEnabled(), exportsdebugLoggers.lmlanguage-model.ts- UsesdebugLoggers.lm.enableddirectlyUpdated workspace configuration:
.vscode/launch.json- Updated comments to document TYPESPEC_DEBUG env var usageHow It Works
By default, all debug messages are suppressed. Users can enable them when troubleshooting using the TYPESPEC_DEBUG environment variable:
The custom implementation provides:
typespec:*)Validation
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.