-
Notifications
You must be signed in to change notification settings - Fork 0
Add default configuration maps for LSP clients to enable extra features #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default configuration maps for LSP clients to enable extra features #15
Conversation
…bled Co-authored-by: observerw <[email protected]>
Co-authored-by: observerw <[email protected]>
Co-authored-by: observerw <[email protected]>
Co-authored-by: observerw <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds default configuration maps to LSP clients, enabling inlay hints, diagnostics, auto-imports, and other advanced features automatically without requiring manual configuration. The implementation adds a create_default_configuration_map() method to the base client class that subclasses override to provide language-server-specific defaults.
Key changes:
- Base client auto-initializes configuration on startup if not explicitly set
- Six client implementations provide tailored defaults (rust-analyzer, gopls, pyright, typescript, deno, pyrefly/ty)
- New
has_global_config()method added to ConfigurationMap for public API access
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lsp_client/client/abc.py | Adds create_default_configuration_map() method and auto-initialization logic in __asynccontextmanager__ |
| src/lsp_client/utils/config.py | Adds has_global_config() public method to check if global configuration exists |
| src/lsp_client/clients/rust_analyzer.py | Implements default config with inlay hints, diagnostics, completion, check-on-save, and code lenses |
| src/lsp_client/clients/gopls.py | Implements default config with hints, code lenses, analyses, completion, and semantic tokens |
| src/lsp_client/clients/pyright.py | Implements default config with inlay hints, auto-imports, type checking, and diagnostics |
| src/lsp_client/clients/typescript.py | Implements default config with inlay hints and suggestions for both TypeScript and JavaScript |
| src/lsp_client/clients/deno/client.py | Implements default config with inlay hints, linting, unstable features, code lens, and import suggestions |
| src/lsp_client/clients/pyrefly.py | Implements default config with inlay hints, diagnostics, and auto-imports |
| src/lsp_client/clients/ty.py | Implements default config with diagnostics and auto-imports (no inlay hints) |
| tests/test_default_configuration.py | Adds 35 tests covering method presence, type validation, content validation, and client-specific features |
| examples/default_configuration.py | Provides example demonstrating default usage, overrides, and inspection of configurations |
| docs/configuration.md | Documents default configurations feature with examples and per-client capability listings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_deno_default_config_has_inlay_hints(): | ||
| """Test that deno default config enables inlay hints.""" | ||
| from lsp_client.clients.deno import DenoClient | ||
|
|
||
| client = DenoClient() | ||
| config_map = client.create_default_configuration_map() | ||
|
|
||
| assert config_map is not None | ||
| config = config_map.get(None, "deno.inlayHints") | ||
| assert config is not None, "deno should have inlay hints configuration" |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage for TyClient default configuration. While the parametrized tests provide general coverage, there's no specific test validating TyClient's configuration content like there is for other clients (rust_analyzer, gopls, pyright, typescript, deno). Consider adding a test_ty_default_config test to ensure the ty-specific configuration keys are properly set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test_ty_default_config_has_diagnostics test that validates TyClient's diagnostics and completion configuration. (661ad01)
| def test_deno_default_config_has_inlay_hints(): | ||
| """Test that deno default config enables inlay hints.""" | ||
| from lsp_client.clients.deno import DenoClient | ||
|
|
||
| client = DenoClient() | ||
| config_map = client.create_default_configuration_map() | ||
|
|
||
| assert config_map is not None | ||
| config = config_map.get(None, "deno.inlayHints") | ||
| assert config is not None, "deno should have inlay hints configuration" |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage for PyreflyClient default configuration. While the parametrized tests provide general coverage, there's no specific test validating PyreflyClient's configuration content like there is for other clients (rust_analyzer, gopls, pyright, typescript, deno). Consider adding a test_pyrefly_default_config test to ensure the pyrefly-specific configuration keys are properly set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test_pyrefly_default_config_has_inlay_hints test that validates PyreflyClient's inlay hints configuration. (661ad01)
| for section in [ | ||
| "rust-analyzer.inlayHints", | ||
| "gopls.hints", | ||
| "python.analysis.inlayHints", | ||
| "typescript.inlayHints", | ||
| "deno.inlayHints", | ||
| "pyrefly.inlayHints", | ||
| ]: |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inlay hints section list in the example is missing "ty.inlayHints". However, upon checking the ty.py implementation, TyClient does not configure inlayHints - it only configures diagnostics and completion. While this is technically correct, it would be helpful to add a comment or include "ty.diagnostics" or "ty.completion" in the list to demonstrate that TyClient is also being checked, so it's clear to readers that all clients are covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added "ty.diagnostics" to the configuration list with a comment explaining that TyClient uses diagnostics instead of inlay hints. This makes it clear all clients are covered. (661ad01)
|
@copilot apply changes based on the comments in this thread |
…umentation Co-authored-by: observerw <[email protected]>
Implementation Complete ✅
Successfully implemented default
configuration_mapfor all built-in LSP clients to automatically enable extra features.Summary of Changes
Client ABC Enhancement (
src/lsp_client/client/abc.py)create_default_configuration_map()method with comprehensive documentation__asynccontextmanager__if not already setDefault Configurations Implemented (7 clients)
ConfigurationMap Enhancement (
src/lsp_client/utils/config.py)has_global_config()public method for better encapsulationComprehensive Testing (
tests/test_default_configuration.py)Documentation (
docs/configuration.md)Example (
examples/default_configuration.py)Recent Updates (addressing PR feedback)
test_pyrefly_default_config_has_inlay_hintstesttest_ty_default_config_has_diagnosticstestty.diagnosticsin the configuration list with explanatory commentTest Results
Security Scan
Benefits
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.