Skip to content

Hovering over possessive form (e.g. account's) shows duplicate definition #121

Description

@aromarious

Problem

When hovering over a possessive form like account's, the definition for Account is shown twice in the hover popup.

Reproduction

  1. Use the default glossary in simple_workspace (which contains a term Account)
  2. Open a file containing the text account's
  3. Hover over account's — the definition for Account appears twice

Why this happens

The apostrophe ' is not in Lexer.delimiters (Tokeniser.fs), so account's is treated as a single token. TokenSplitterRegex (CandidateTerms.fs) then splits it into ["account", "s"], and normalise generates window chunks: "account" (size 1) and "accounts" (size 2). Since "accounts" is singularized to "account" by Humanizer, the same term matches twice.

Possible fixes

  1. Add ' to Lexer.delimiters — the tokeniser would split account's into account and s before candidate term generation. This is arguably the correct behaviour since possessive 's is not part of the word itself.
  2. Add Seq.distinctBy in findMatchingTermsInIndex (Hover.fs) — deduplicate matches by term name. This is a narrower fix that doesn't change tokenisation.

I'm happy to submit a PR for either approach. What do you think?

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions