Repository navigation
Fix LSP issues found by the new tests - #106
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b644e2c. Configure here.
| SymbolHoverKind::Binding { | ||
| type_name: self.type_name(scopes, self.symbol_type(scopes, symbol)), | ||
| } | ||
| } |
There was a problem hiding this comment.
Inline let hover drops keyword
Low Severity
SymbolHoverKind::Binding has no inline flag, and symbol_hover_kind ignores BindingSymbol.inline. Hover therefore always renders let, even when the binding was declared inline let. Constants and functions in this change do surface inline.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b644e2c. Configure here.
Rigidity
added this pull request to stack #107
October 12, 2026 22:56
LSP positions count characters in UTF-16 code units, but the server treated them as character counts and then used the result as a byte offset. Convert between byte offsets and LSP positions properly, and make LineCol::new treat its index as a byte offset, which is what callers pass.
Hover now renders functions as `fn name<T>(params) -> Ret`, constants as
`const`, parameters without `let`, and marks inline items. Builtins have
no function type, so they showed up as {unresolved}; add hand written
signatures for each way a builtin can be called and use them for hover
and completion details.
Substituting an alias or struct kept its declared generic parameters, so List<Int> was displayed as List. Substitute the generics along with the inner type, include them when stringifying named aliases and structs, and order applied arguments by their parameters instead of HashMap order. The LSP now uses this for type names, and hover shows the generic parameters of declarations, e.g. `type List<T> = ...`.
Type completions came from the completion context of a type node, so nothing was suggested before anything had been typed, e.g. after `value: ` or `-> `. Look at the token before the cursor instead, and treat colons in parameters, let statements, constants and struct fields, return arrows, casts, guards and type alias definitions as type positions.
Rigidity
force-pushed
the
lsp-test-followups
branch
from
October 12, 2026 22:57
b644e2c to
f3ecb6c
Compare
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.


Stacked on #105. This fixes the behaviour that #105's snapshots recorded but left alone. Each fix is a separate commit, and the snapshot diffs show exactly what changed.
Changes
UTF-16 positions (
2f76b93)position.rs, which converts between byte offsets and LSP positions in both directions. It's used for incoming cursor positions, locations and diagnostics.LineCol::newnow treats its index as a byte offset, which is what callers pass. This also corrects CLI error columns after non-ASCII text.Declaration keywords and builtin signatures (
4e504af)fn name<T>(params) -> Ret,const NAME: Tandname: Tfor parameters, and addsinlinewhere it applies. Previously everything was shown aslet.{unresolved}.Builtin::signatures()inrue-hirnow gives a hand-written signature for each way a builtin can be called, matching the rules incompile_builtin. Hover lists all of them; the completion detail shows the first.Generic arguments (
f5957af)substitutecopied aliases and structs but kept their declared generic parameters, soList<Int>was printed asList. The generics are now substituted along with the inner type, andstringifyincludes them for named aliases and structs.Applytype are now printed in the order of their parameters. Previously they followedHashMaporder.type List<T> = nil | (T, List<T>)andstruct Wrapper<T> { ... }.Completion in empty type positions (
b644e2c)let,constand struct fields count as type positions, as do->,as,is, and the=of a type alias.Test plan
cargo test --workspace --all-features: 75 LSP tests, up from 53, plus newpositionandLineColunit tests. The compiler's YAML snapshots are unchanged.cargo clippy --workspace --all-features --all-targets(no warnings),cargo fmt --check,cargo machete,rue fmt --checkNote
Medium Risk
Touches position math used by all LSP features and type substitution/stringify shared beyond the server; regressions could misalign diagnostics or change displayed types.
Overview
Fixes several Rue LSP behaviors that broke on non-ASCII text, empty type positions, and richer type/symbol display.
UTF-16 positions: Adds
position.rsto convert between byte offsets and LSP positions (UTF-16 code units). Hover, go-to-definition, references, diagnostics, and cursor mapping now use it.LineColtreats indices as byte offsets and counts columns in Unicode characters, aligning CLI columns with the same model.Hover and completions: Hover distinguishes bindings (
let), parameters,const/inline const, andfn/inline fnwith full signatures (generics, spread params).Builtin::signatures()supplies completion details and multi-signature hover for builtins instead of{unresolved}.Generic types:
substitutenow substitutes generic parameters on structs/aliases;stringifyprintsName<Args>in parameter order forApplytypes. Hover shows generic declarations (e.g.List<T>,Wrapper<T>).Completions: When no type AST exists yet, syntax-aware
expects_typeoffers types after->,as,is, annotated colons, and type-alias=—but not struct initializer values.Reviewed by Cursor Bugbot for commit f3ecb6c. Bugbot is set up for automated code reviews on this repo. Configure here.