Repository navigation
Only filter issue completions by an owner/repo written right before # - #9241
Federico Brancasi (federicobrancasi) wants to merge 2 commits into
Conversation
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>
There was a problem hiding this comment.
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/repodetection 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>
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: 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 |


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 messageFix 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 like11/29. Why: the owner/repo filter added in #5262 (forowner/repo#) runs/([^\s]+)\/([^\s]+)/on all the text from the start of the line to the#. It is not anchored to the#, so it findssrc/extension.ts,, filters to ownersrcand repoextension.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 asISSUE_EXPRESSION, so onlyowner/repo#written directly before the#filters the list (this also makes(octocat/hello-world#work).How to test
npm run compile:test, then the repo's extension test runner (out/src/test/index.jsthrough@vscode/test-electronrunTests, with a local VS Code Insiders 1.148.0 instead of the download inout/src/test/runTests.js)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