Skip to content

Fix tooltip showing mangled module suffix for companion modules (#17335)#19867

Open
T-Gro wants to merge 4 commits into
mainfrom
fix/issue-17335
Open

Fix tooltip showing mangled module suffix for companion modules (#17335)#19867
T-Gro wants to merge 4 commits into
mainfrom
fix/issue-17335

Conversation

@T-Gro
Copy link
Copy Markdown
Member

@T-Gro T-Gro commented May 29, 2026

Description

Fixes #17335

When a module has the same name as a type (companion module), the tooltip for values in that module was showing the mangled ModuleModule suffix instead of the demangled name. For example, unc123 in module MyType would show MyType.MyTypeModule.func123 instead of MyType.MyType.func123.

Root Cause

In ullNameOfParentOfValRef and ullNameOfParentOfValRefAsLayout, the VRefLocal case was using ullNameOfPubPath which walks the raw public path without demangling module names. The VRefNonLocal case already used DemangledModuleOrNamespaceName correctly.

Fix

For VRefLocal values that have a declaring entity available, use ullNameOfEntityRef with DemangledModuleOrNamespaceName (matching the VRefNonLocal path). Fall back to the old ullNameOfPubPath behavior only when no declaring entity is present.

Testing

Added tooltip tests verifying correct demangling for:

  • Functions in companion modules
  • Nested companion modules
  • Values in regular modules (regression check)

Copilot and others added 3 commits May 29, 2026 18:21
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Routes the VRefLocal branch of fullNameOfParentOfValRef[AsLayout] through
fullNameOfEntityRef[AsLayout] using TryDeclaringEntity. This reuses the
existing entity-walking helper that calls DemangledModuleOrNamespaceName,
so companion modules (FSharpModuleWithSuffix) lose their 'Module' suffix
in the 'Full name:' tooltip, matching the VRefNonLocal branch behavior.

Fixes #17335.

Also corrects the caret placement in the 'ModuleSuffix attribute without
companion type demangles' test (added in Sprint 01) so that the resolve
position lands on the identifier 'x' rather than the preceding space.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Module suffix is visible in VS tooltips

2 participants