Refactor ClientMetadata to ClientInfo and enhance path parsing#37
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors how client/server environment metadata is represented (moving from a global ClientMetadata to per-server EditorInfo and a new ServerInfo), and enhances path parsing to recognize more path-like tokens (bare paths and colon-delimited mount/PATH-style segments).
Changes:
- Replace global client environment (
ClientMetadata+ async global getter/setter) withEditorInfostored onPathServerviaOnceLock, and addServerInfofor version/mode logging. - Improve path extraction by recognizing bare path tokens (not just quoted strings) and by splitting colon-delimited tokens to extract volume-mount style paths.
- Update language identifiers and documentation/changelog entries accordingly.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/server.rs | Stores editor/server metadata on the server instance and uses it in feature gating (e.g., document links/hover). |
| src/server_info.rs | Introduces ServerInfo/ServerMode for version + debug/release mode reporting. |
| src/providers/document_link.rs | Removes dependence on global client metadata; expects server-side gating for capability checks. |
| src/parser/path/regex.rs | Extends regex fallback extraction to include bare, whitespace-delimited path tokens. |
| src/parser/path/mod.rs | Adds colon-delimited splitting to extract paths from docker-compose/PATH-like tokens; adds tests. |
| src/lib.rs | Updates module layout to remove client and add editor_info/server_info. |
| src/editor_info.rs | Adds EditorInfo extracted from LSP InitializeParams. |
| src/document/language.rs | Adds a dockercompose language identifier mapping. |
| src/client.rs | Removes the global client environment module. |
| README.md | TODO list updated (needs alignment with implemented behavior). |
| CHANGELOG.md | Adds Unreleased notes (needs alignment with actual refactor naming). |
Comments suppressed due to low confidence (2)
src/server.rs:432
- Same issue as in
document_link:.get().expect("Editor info must be initialized")can panic ifhoveris invoked before initialization. Consider gracefully handling the missingeditor_infocase instead of panicking.
let editor_info = self
.editor_info
.get()
.expect("Editor info must be initialized");
let config = self.get_config().await;
src/parser/path/mod.rs:133
- In this test case,
end_byteshould match the content length (exclusive end) to keepPathCandidateranges consistent. The string "./data:/app/data:ro" is 19 bytes long, butend_byteis set to 18.
let candidate = PathCandidate {
content: "./data:/app/data:ro".to_string(),
start_byte: 0,
end_byte: 18,
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+87
to
+91
| self.editor_info.set(editor_info).unwrap(); | ||
| // set server info | ||
| let server_info = ServerInfo::new(); | ||
| lsp_info!("Server Info: {}", server_info).await; | ||
| self.server_info.set(server_info).unwrap(); |
Comment on lines
+308
to
+311
| let editor_info = self | ||
| .editor_info | ||
| .get() | ||
| .expect("Editor info must be initialized"); |
Comment on lines
+44
to
+48
| // Level 3: the part of string (split by colon) is a path or not | ||
| // Handles docker-compose volume mounts (e.g., ./src:/app/src) | ||
| // and PATH-like environment variables (e.g., /usr/bin:/usr/local/bin) | ||
| results.extend(path_ref.split(&[':', ':'])); | ||
|
|
| let candidate = PathCandidate { | ||
| content: "/host/path:/container/path".to_string(), | ||
| start_byte: 0, | ||
| end_byte: 25, |
Comment on lines
142
to
146
| - [x] Support path highlight. | ||
| - [x] Support remote window. | ||
| - [x] Improve path extraction precision. | ||
| - [ ] Support tokenize by `:` in docker-compose. | ||
| - [ ] **Zed**: Support all language by use "wildcard" in extension.toml (Waiting for Zed extension api support) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
No description provided.