Skip to content

Refactor ClientMetadata to ClientInfo and enhance path parsing#37

Merged
kunlinglio merged 7 commits into
masterfrom
dev
May 25, 2026
Merged

Refactor ClientMetadata to ClientInfo and enhance path parsing#37
kunlinglio merged 7 commits into
masterfrom
dev

Conversation

@kunlinglio
Copy link
Copy Markdown
Owner

No description provided.

@kunlinglio kunlinglio requested a review from Copilot May 25, 2026 01:07
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 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) with EditorInfo stored on PathServer via OnceLock, and add ServerInfo for 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 if hover is invoked before initialization. Consider gracefully handling the missing editor_info case 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_byte should match the content length (exclusive end) to keep PathCandidate ranges consistent. The string "./data:/app/data:ro" is 19 bytes long, but end_byte is 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 thread src/server.rs
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 thread src/server.rs
Comment on lines +308 to +311
let editor_info = self
.editor_info
.get()
.expect("Editor info must be initialized");
Comment thread src/parser/path/regex.rs Outdated
Comment thread src/parser/path/mod.rs
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(&[':', ':']));

Comment thread src/parser/path/mod.rs Outdated
let candidate = PathCandidate {
content: "/host/path:/container/path".to_string(),
start_byte: 0,
end_byte: 25,
Comment thread README.md
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)
Comment thread CHANGELOG.md Outdated
kunlinglio and others added 3 commits May 25, 2026 09:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kunlinglio kunlinglio merged commit 63a4dd6 into master May 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants