Add support for struct auto-completion#57
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7823a10. Configure here.
| Detail: "variable", | ||
| SortText: "000_" + varName, | ||
| }) | ||
| } |
There was a problem hiding this comment.
Variable sort priority leaks into non-struct completions
Medium Severity
The addVariableCompletion helper unconditionally sets SortText: "000_" + varName, which forces variables to sort before all other completions. This was intended only for struct value positions (where variables are the likely target), but the same helper is used in the regular funcPrefix != "" path too. Previously, variable completions had no SortText and sorted naturally alongside functions. This changes the ordering behavior of all non-struct completions as a side effect.
Reviewed by Cursor Bugbot for commit 7823a10. Configure here.


#43
Note
Medium Risk
Adds a new CodeIntel protocol op and asynchronous caching to drive struct-field completions, touching completion triggers and concurrency paths in the LSP server. Risk is mainly around cache invalidation/build-root scoping and potential completion regressions in edge cursor positions.
Overview
Adds Elixir struct field auto-completion for
%Module{...}by introducing a new BEAM CodeIntel op (struct_fields) that loads a compiled struct module and returns its sorted field names.The LSP server now detects struct key vs value cursor positions, serves field-key completions (with
field:insertion), and avoids offering field completions in value positions; value positions instead prioritize local variable completions. Struct fields are fetched asynchronously via a new per-build-root cache with invalidation on file reindex/removal and BEAM process eviction, plus document-open/change prewarming based on struct literals found in the buffer.Completion trigger characters are expanded (including space) with gating logic to avoid firing on ordinary whitespace, and tests are added for struct context parsing, caching/invalidation, prewarm behavior, and the new completion behaviors.
Reviewed by Cursor Bugbot for commit 7823a10. Bugbot is set up for automated code reviews on this repo. Configure here.