Skip to content

fix: prioritize @ file search over slash command completion#62

Open
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-2519-fix-at-completion-after-slash-command
Open

fix: prioritize @ file search over slash command completion#62
BingqingLyu wants to merge 1 commit into
mainfrom
fork-pr-2519-fix-at-completion-after-slash-command

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

TLDR

Fix @ file search not working after selecting a custom slash command on the same line.

Fixes QwenLM#2518

Dive Deeper

Root Cause

In useCommandCompletion, the completion mode detection checks for slash commands before checking for @ file references:

if (cursorRow === 0 && isSlashCommand(currentLine.trim())) {
  return { completionMode: CompletionMode.SLASH, ... };
}
// @ detection never reached when line starts with /

Since isSlashCommand() returns true for any line starting with / (excluding // and /*), typing @ after a completed slash command like /qc:create-issue @readme still matches the slash command check first, and the @ file search code is never executed.

Fix

Reorder the completion mode detection to check for @ file references before slash commands. When the cursor is positioned after an @ character (within the current word boundary), AT mode takes priority. If no @ is found, the slash command check runs as before.

This preserves all existing behaviors:

  • /help → SLASH mode (no @ in text) ✓
  • /model qwen3 → SLASH mode (no @ in text) ✓
  • /qc:create-issue @readme → AT mode (@ found before cursor) ✓
  • @file → AT mode (no change) ✓
  • plain text → IDLE mode (no change) ✓

Testing Matrix

  • All 15 existing + new tests pass (useCommandCompletion.test.ts)
  • Added regression test: @ after slash command triggers AT completion
  • Pre-commit hooks (prettier + eslint) pass

When typing @ after a custom slash command on the same line (e.g.,
`/qc:create-issue @readme`), the @ file search feature was not
triggered because the slash command check ran first and returned
SLASH mode for the entire line.

Reorder the completion mode detection to check for @ file references
before slash commands. This ensures file search works correctly when
@ appears after a slash command, while preserving all existing slash
command and @ completion behaviors.

Fixes QwenLM#2518
@BingqingLyu

BingqingLyu commented May 7, 2026

Copy link
Copy Markdown
Owner Author

Conflict Group 1

This PR shares modified functions with 2 other PR(s): #74, #9.

These PRs should be reviewed as a batch — merging one may affect the others.

Function File Also modified by
useCommandCompletion useCommandCompletion.tsx #74, #9
graph LR
    PR62["PR #62"]
    FuseCommandCompletion_8197["useCommandCompletion<br>useCommandCompletion.tsx"]
    PR62 -->|modifies| FuseCommandCompletion_8197
    PR74["PR #74"]
    PR74 -->|modifies| FuseCommandCompletion_8197
    PR9["PR #9"]
    PR9 -->|modifies| FuseCommandCompletion_8197
Loading

Posted by codegraph-ai conflict detection.

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

Labels

conflicting-group-1 Conflicting PR group 1 — review as a batch conflicting-pr Shares at least one cross-PR dependency with other PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ file search stops working after selecting a custom slash command

2 participants