Skip to content

fix(ui): limit symbol references to code-like tokens - #559

Open
sudo-tee wants to merge 1 commit into
mainfrom
fix/558-symbol-references-prose
Open

sudo-tee wants to merge 1 commit into
mainfrom
fix/558-symbol-references-prose

Conversation

@sudo-tee

Copy link
Copy Markdown
Owner

Fixes #558

Problem

Since #489 widened symbol candidates to every available file and loaded buffer, assistant prose highlighted ordinary words (to, first, line, ...) as OpencodeSymbolReference, and gd/<CR> on them offered unrelated locals.

Fix

symbol_tokens.is_code_like gates both symbol target creation and highlighting in formatter.lua. A token qualifies when it:

  • contains _, . or : (switch_to_mode, M.apply, A::b), or
  • has camelCase (fooBar), or
  • is wrapped directly in backticks (`first`).

Plain words in prose, and plain words inside fenced blocks or longer inline spans, no longer match.

Tests

  • New unit tests for is_code_like and prose filtering in the formatter.
  • Updated existing symbol tests and the symbol-reference-navigation.json fixture to backtick the bare collect token.
  • make check passes.

Assistant prose highlighted ordinary words as symbol references once candidate files widened to all available files. Only accept tokens that look like identifiers (contain _, ., :, or camelCase) or are wrapped in backticks.

Fixes #558
@github-actions

Copy link
Copy Markdown

🏗️ Architecture check

Checks that require() calls between modules follow the layer rules in scripts/dependency-topology/topology.jsonc (entry → dispatch → services/UI → server/protocols; shared helpers usable everywhere).

Compared origin/main → HEAD.

Before After Δ
Imports breaking layer rules 0 0 +0
Import loops 0 0 +0
Modules in largest loop 0 0 +0
Modules without a layer 0 0 +0

Imports between modules: +0 / -0

✅ No new problems

Run locally: make topology-check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Symbol references highlight ordinary words in assistant prose

1 participant