Skip to content

In Visual Studio: Renaming operator with . only renames right of . #14057

Closed

Description

@Booksbaum

In VS: renaming an operator containing . only renames right of ., but keeps everything left (including .) of .

Repro steps

let (-.-) a b = a + b
let _ = 1 -.- 2

Rename (F2) on -.- (doesn't matter if decl or usage)
-> only last - gets selected and replaced when renamed with something:

Rename Operator

Expected behavior

Select and rename complete operator

Actual behavior

Selects and renames only right of .

Known workarounds

Rename all with Search&Rename

Related information

I think the issue is in:

/// Fix invalid span if it appears to have redundant suffix and prefix.
let fixupSpan (sourceText: SourceText, span: TextSpan) : TextSpan =
let text = sourceText.GetSubText(span).ToString()
// backticked ident
if text.EndsWith "``" then
match text.LastIndexOf("``", text.Length - 3, text.Length - 2) with
| -1 | 0 -> span
| index -> TextSpan(span.Start + index, text.Length - index)
else
match text.LastIndexOf '.' with
| -1 | 0 -> span
| index -> TextSpan(span.Start + index + 1, text.Length - index - 1)

span gets adjusted to remove parts like leading Namespaces, Modules, Types. This is done by retrieving text after last . (if no backticks). For normal identifiers that's ok -- but . is allowed in operators -> TextSpan for operators with . only contains part right of . (-.- -> -)



Provide any related information (optional):

  • Win 11 x64
  • Microsoft Visual Studio Community 2022 (64-bit) Version 17.3.5

Activity

  1. added
    Area-LangService-RenameSymbol
    on Oct 9, 2022
  2. added this to the Backlog milestone on Oct 17, 2022
  3. added
    Impact-Medium
    Area-VS-Editor
    and removed on Nov 21, 2022
  4. github-actions commented on Mar 22, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    This issue appears to be fixed by PR #19252 (merged 2026-02-12), which fixed rename handling in Tokenizer.FixedSpan to correctly handle operators containing .. The fix is included in the F# 10.0.300 release notes:

    Fixed Rename not correctly handling operators containing . (e.g., -.-). (Issue #17221, Issue #14057, PR #19252)

    To verify the fix, try renaming -.- in VS and it should now rename the complete operator instead of just the part after the last ..

    If this is confirmed fixed, the issue can be closed.

    Generated by Repo Assist · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@9135cdfde26838a01779aa966628308404ec1f02
    
  5. added 2 commits that reference this issue on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI-thinks-issue-fixedAI-thinks-windows-onlyArea-LangService-RenameSymbolArea-VS-EditorBugImpact-Medium

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions