Nimblesite / Nimblesite/SharpLsp

F#: completion auto-`open` insertion (FSAC parity) needs an unopened-symbol entity index

Open
#122 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cluster:fsharp-project-model
Dominant language
TypeScript
Stars
132
Forks
5
Avg merge
6h 24m
Merged PRs (30d)
27

Description

Gap

Ionide/FSAC offer auto-`open` on completion: accepting a completion for a type/value in a not-yet-opened namespace inserts the corresponding `open` directive (via `completionItem/resolve` → `additionalTextEdits`). SharpLsp's F# `completionItem/resolve` currently returns no edits.

This is tracked as item 11 in docs/plans/FSHARP-FSAC-PARITY-PLAN.md and as the `[FS-COMPLETION-RESOLVE]` follow-up in docs/plans/FSHARP-FEATURES-PLAN.md.

Why it's not a one-liner

The blocker is upstream of resolve: FSharpCompletion.getCompletions calls
checkResults.GetDeclarationListInfo(..., getAllEntities = fun () -> []) with an empty entity provider. With no entities, FCS never surfaces completion items for symbols in unopened namespaces, so DeclarationListItem.NamespaceToOpen is always None and there is nothing to auto-open.

Real auto-open requires:

  1. An assembly-content / entity index (FSAC's AssemblyContentProvider) built from the project's referenced assemblies + the current file's symbols, fed into getAllEntities so unopened-namespace items appear in the list with a populated NamespaceToOpen.
  2. A per-file resolve cache mapping the completion item index → the open-insertion TextEdit, computed at completion time with ParsedInput.FindNearestPointToInsertOpenDeclaration + ParsedInput.AdjustInsertionPoint. The Rust host's completionItem/resolve already maps AdditionalEditsadditionalTextEdits (src/semantic.rs), so once the sidecar returns edits it just works end-to-end.

Scope

Self-contained but non-trivial (entity index has its own caching/perf characteristics). Wire contract (CompletionResolveResultWire.AdditionalEdits) already exists.

Related parity work just landed: remove-unused-open / simplify-name code fixes ([FS-CODEFIX-*]) and F# workspace/symbol ([FS-WORKSPACE-SYMBOL]).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with FSharpCompletion.getCompletions and its getAllEntities provider, then inspect the AdditionalEdits mapping in src/semantic.rs and the referenced parity plans. Build the entity index and per-file resolve cache described in the issue, and verify that completionItem/resolve returns the open-insertion edit for symbols from unopened namespaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp, rust
Domain
developer-experience, devtools, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.