Skip to content

Use ValueOption to look up a reference's definition item - #20534

Merged
T-Gro merged 2 commits into
dotnet:mainfrom
xperiandri:find-usages-definition-lookup-voption
Sep 15, 2026
Merged

T-Gro merged 2 commits into
dotnet:mainfrom
xperiandri:find-usages-definition-lookup-voption

Conversation

@xperiandri

@xperiandri xperiandri commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Description

FSharpFindUsagesService.onSymbolFound looks up which definition item a reference belongs to with Array.tryFind and Option. This repo's convention (FSharp.instructions.md) is voption in new and touched code; Common/Extensions.fs already has Array.tryFindV for this exact case.

definitionItems
|> Array.tryFindV (snd >> (=) doc.Project.FilePath)
|> ValueOption.map (fun (definitionItem, _) -> definitionItem)
|> ValueOption.defaultValue externalDefinitionItem

Split out of #20533's review, where this line sat unchanged in the diff context.

Checklist

  • Test cases added: none, behavior is unchanged.
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated: not applicable, no user-visible change.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ Found changes and release notes in following paths:

Change path Release notes path Description
`vsintegration/src` docs/release-notes/.VisualStudio/18.vNext.md

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager label Sep 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Design-Time
Affects-Design-Time: Changes IDE Find Usages execution.

Generated by PR Tooling Safety Check · gpt56 964.8K ·

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 🕵️ LGTM

@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Sep 14, 2026
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Sep 14, 2026
@T-Gro
T-Gro self-requested a review September 14, 2026 14:26
@xperiandri xperiandri changed the title Use ValueOption to look up a reference's definition item Use ValueOption to look up a reference's definition item Sep 14, 2026

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖🕵️ Please shorten the description using this guidance. Focus on the problem and why the change is needed, in simplified technical English. Leave the implementation inventory to the Files tab and retain necessary caveats.

@xperiandri

Copy link
Copy Markdown
Contributor Author

This is already short enough, no?

@xperiandri
xperiandri requested a review from T-Gro September 15, 2026 08:19
@T-Gro

T-Gro commented Sep 15, 2026

Copy link
Copy Markdown
Member

@xperiandri :

Apologies, my wording wasn't clear - in this case it's not shortness.
Its about not re-narrating the implementation - the "Files" tab shows that.
Reducing option allocations in FSharpFindUsagesService.onSymbolFound and showing benchmark data would tell the WHY (because Option module is inlined, so often there is not much to be saved)

@T-Gro
T-Gro merged commit 91aead5 into dotnet:main Sep 15, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in F# Compiler and Tooling Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager AI-reviewed PR reviewed by AI review council

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants