lsp: show literal hover types and initialize server info#127
lsp: show literal hover types and initialize server info#127bneiswander wants to merge 3 commits into
Conversation
Return ServerInfo name/version in initialize response so clients can confirm which binary/version they are running when debugging behavior.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR adds server metadata to the LSP initialize response and returns direct hover results for primitive expression kinds via a new helper, avoiding the generic checked-type fallback. ChangesLSP Server Improvements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
compiler-bin/src/lsp.rs (1)
119-120: ⚡ Quick winDerive server name from Cargo metadata to avoid drift.
Using
env!("CARGO_PKG_NAME")keeps name/version sourced from the same metadata and avoids manual string mismatch later.Proposed patch
server_info: Some(ServerInfo { - name: "purescript-analyzer".to_string(), + name: env!("CARGO_PKG_NAME").to_string(), version: Some(env!("CARGO_PKG_VERSION").to_string()), }),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@compiler-bin/src/lsp.rs` around lines 119 - 120, Replace the hardcoded server name string with Cargo metadata so name/version come from the same source; specifically change the field where name is set (currently name: "purescript-analyzer".to_string()) to use env!("CARGO_PKG_NAME").to_string() while keeping version as env!("CARGO_PKG_VERSION").to_string() so both name and version are derived from Cargo package metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@compiler-bin/src/lsp.rs`:
- Around line 119-120: Replace the hardcoded server name string with Cargo
metadata so name/version come from the same source; specifically change the
field where name is set (currently name: "purescript-analyzer".to_string()) to
use env!("CARGO_PKG_NAME").to_string() while keeping version as
env!("CARGO_PKG_VERSION").to_string() so both name and version are derived from
Cargo package metadata.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8e454781-0992-4a95-9a09-9fdba9317f06
📒 Files selected for processing (2)
compiler-bin/src/lsp.rscompiler-lsp/analyzer/src/hover.rs
lsp: show literal hover types and initialize server info
Base branch:
mainReview Order
This PR is independent and can be reviewed against
mainat any time. It is intentionally small LSP polish and does not depend on the execute-command or diagnostics-refresh PRs.Summary
server_infoin the LSP initialize result so clients can display the analyzer name/version.Motivation
Hovering on basic literals is a common editor interaction. For literals such as strings, chars, booleans, integers, and numbers, the type is known directly from the lowered expression kind, so the hover path does not need to depend on later checked-node metadata.
The initialize response also benefits from including server identity metadata. Some clients surface this in logs, status output, or server selection UI.
Motivating Example
In an editor, hovering over these literal expressions should return the obvious PureScript type:
Implementation Notes
String,Char,Boolean,Integer, andNumberexpression kinds.server_infoto the analyzer package name and version.Tests
Validation run locally: