Skip to content

Only filter issue completions by an owner/repo written right before # - #9241

Draft
Federico Brancasi (federicobrancasi) wants to merge 2 commits into
mainfrom
fbrancasi/issue-completion-repo-filter
Draft

Federico Brancasi (federicobrancasi) wants to merge 2 commits into
mainfrom
fbrancasi/issue-completion-repo-filter

Conversation

@federicobrancasi

Copy link
Copy Markdown
Member

When you type # in the commit message box, a plaintext or markdown file, or a code comment, issue suggestions disappear if any word with a / appears earlier on the same line. For example, in the commit message Fix crash in src/extension.ts, closes # the list shows only "Configure issue queries..." instead of your issues. The same happens after a URL (// See https://example.com/docs for details, tracked in #), "and/or", or a date like 11/29. Why: the owner/repo filter added in #5262 (for owner/repo#) runs /([^\s]+)\/([^\s]+)/ on all the text from the start of the line to the #. It is not anchored to the #, so it finds src/extension.ts,, filters to owner src and repo extension.ts,, and no issue matches.

This PR anchors the match to the end of the text before the # and uses the same owner and repository name characters as ISSUE_EXPRESSION, so only owner/repo# written directly before the # filters the list (this also makes (octocat/hello-world# work).

How to test

Command Result
npm run compile:test, then the repo's extension test runner (out/src/test/index.js through @vscode/test-electron runTests, with a local VS Code Insiders 1.148.0 instead of the download in out/src/test/runTests.js) 1431 passing; the new test "IssueCompletionProvider does not filter by a path that appears earlier on the line" fails without the change
npx eslint src/issues/issueCompletionProvider.ts, npx tsc --noEmit -p tsconfig.json, node ./build/hygiene.js src/issues/issueCompletionProvider.ts src/test/issues/issueCompletionProvider.test.ts, npm run compile pass

When you type `#` in the commit message box, a plaintext or markdown file, or a code comment, issue suggestions disappear if any word with a `/` appears earlier on the same line. For example, in the commit message `Fix crash in src/extension.ts, closes #` the list shows only "Configure issue queries..." instead of your issues. The same happens after a URL (`// See https://example.com/docs for details, tracked in #`), "and/or", or a date like `11/29`. Why: the owner/repo filter added in #5262 (for `owner/repo#`) runs `/([^\s]+)\/([^\s]+)/` on all the text from the start of the line to the `#`. It is not anchored to the `#`, so it finds `src/extension.ts,`, filters to owner `src` and repo `extension.ts,`, and no issue matches.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
What changed in this PR

Adjusts issue completion filtering so owner/repo# is only recognized when it appears immediately before #, avoiding false positives from paths, URLs, and dates earlier in the line.

Changes:

  • Anchor the owner/repo detection regex to the end of the text before # and restrict allowed characters.
  • Add tests to ensure completions filter only when owner/repo# is directly before #.
  • Add regression coverage for a path earlier on the line (e.g., src/extension.ts) not affecting suggestions.
File Description
src/​issues/​issueCompletionProvider.ts Anchors and tightens owner/repo matching so only owner/repo# immediately before # filters results.
src/​test/​issues/​issueCompletionProvider.test.ts Adds tests verifying correct filtering behavior and preventing regressions from earlier / tokens on the line.

Review effort: Lite

);
const ownerRepo = document.getText(ownerRepoRange);
const ownerRepoMatch = ownerRepo.match(/([^\s]+)\/([^\s]+)/);
const ownerRepoMatch = ownerRepo.match(/([A-Za-z0-9_.\-]+)\/([A-Za-z0-9_.\-]+)$/);
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The issue-completion filtering change has no active review issues.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

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.

2 participants