Nimblesite / Nimblesite/SharpLsp

F# go-to-definition on a BCL type opens a nonexistent file

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
132
Forks
5
Avg merge
6h 24m
Merged PRs (30d)
27

Description

Symptom

Go-to-definition on an imported F# type navigates to a path that does not exist.

  • DateTimeFilePath = "startup", Line = 0
  • List.sumD:\a\_work\1\s\src\fsharp\src\FSharp.Core\list.fsi (a Microsoft build-server path)

The editor opens a file the user does not have. Members are unaffected: DateTime.UtcNow correctly reaches the decompiled System.DateTime.cs:126.

Root cause

src/sidecars/SharpLsp.Sidecar.FSharp/FSharpSemanticNavigation.fs:154-160extractDefinition prefers symbol.DeclarationLocation over FSharpMetadataNavigator.tryResolve. FCS fills DeclarationLocation with rangeStartup for imported entities, so the phantom range wins before the metadata navigator is ever consulted.

A consequence: the FSharpEntity arm at FSharpMetadataNavigator.fs:18 is unreachable dead code.

Fix direction

Consult FSharpMetadataNavigator.tryResolve first for imported symbols, or reject a DeclarationLocation that is rangeStartup / names a file that is not in the workspace, before falling back to it.

Why this matters

CLAUDE.md aim #2 makes F# a first-class citizen. C# go-to-definition decompiles metadata correctly; F# does not for types, so F# is strictly behind here.

Provenance

Found while raising F# sidecar coverage for PR #218 (94.03% → 95.58%). Deliberately not fixed there — adding a failing test would have reddened the coverage gate, and the defect predates that PR.

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 in src/sidecars/SharpLsp.Sidecar.FSharp/FSharpSemanticNavigation.fs at extractDefinition and inspect how it handles imported symbols. Then read FSharpMetadataNavigator.fs, especially the FSharpEntity arm at line 18, and run the existing F# sidecar coverage tests. Done means go-to-definition for imported F# types resolves to available metadata or decompiled source rather than startup or external paths, while member navigation remains working.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.