Skip to content

Commit 34914b5

Browse files
authored
Fix excluding assignee from query (#6399)
Fixes #6375
1 parent 02e1f30 commit 34914b5

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/lm/tools/searchTools.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ You are an expert on GitHub issue search syntax. GitHub issues are always softwa
9898
- assignee:@me milestone:"October 2024" is:open is:issue sort:reactions
9999
- comments:>5 org:contoso is:issue state:closed mentions:@me label:bug
100100
- interactions:>5 repo:contoso/cli is:issue state:open
101+
- repo:microsoft/vscode-python is:issue sort:updated -assignee:@me
101102
- Go through each word of the natural language query and try to match it to a syntax component.
102-
- Use a "-" in front of a syntax component to indicate that it should be excluded from the search.
103+
- Use a "-" in front of a syntax component to indicate that it should be "not-ed".
103104
- As a reminder, here are the components of the query syntax:
104105
${JSON.stringify(githubSearchSyntax)}
105106
`;
@@ -242,7 +243,8 @@ You are getting ready to make a GitHub search query. Given a natural language qu
242243
}
243244
const propAndVal = part.split(':');
244245
if (propAndVal.length === 2) {
245-
const label = propAndVal[0];
246+
const hasMinus = propAndVal[0].startsWith('-');
247+
const label = hasMinus ? propAndVal[0].substring(1) : propAndVal[0];
246248
const value = propAndVal[1];
247249
if (!label.match(/^[a-zA-Z]+$/)) {
248250
continue;

src/lm/tools/toolsUtils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ export abstract class RepoToolBase<T> extends ToolBase<T> {
7070
if (owner && name) {
7171
await folderManager.createGitHubRepositoryFromOwnerName(owner, name);
7272
} else {
73-
owner = folderManager.gitHubRepositories[0].remote.owner;
74-
name = folderManager.gitHubRepositories[0].remote.repositoryName;
73+
const defaults = await folderManager.getPullRequestDefaults();
74+
if (defaults) {
75+
owner = defaults.owner;
76+
name = defaults.repo;
77+
} else {
78+
owner = folderManager.gitHubRepositories[0].remote.owner;
79+
name = folderManager.gitHubRepositories[0].remote.repositoryName;
80+
}
7581
}
7682
}
7783

0 commit comments

Comments
 (0)