Conversation
| "default": [], | ||
| "description": "A list of repositories to query for issues." | ||
| }, | ||
| "github.host": { |
There was a problem hiding this comment.
Would it be difficult to support multiple hosts?
There was a problem hiding this comment.
I think, if you set multiple hosts, you need to set multiple user names and passwords for each hosts.
src/github-issues-prs.ts
Outdated
| private children: Promise<TreeItem[]> | undefined; | ||
|
|
||
| private username: string | undefined; | ||
| private host: string | undefined; |
There was a problem hiding this comment.
getGitHubRemotes() has two references to "github.com". I guess that needs to be updated too. Do you have access to a GitHub Enterprise install?
There was a problem hiding this comment.
Thanks, I'll fix.
But, I don't have GHE. How should I test for GHE environment?
src/github-issues-prs.ts
Outdated
| for (const url of new Set(allMatches(/^[^\s]+\s+([^\s]+)/gm, stdout, 1))) { | ||
| const m = /[^\s]*github\.com[/:]([^/]+)\/([^ ]+)[^\s]*/.exec(url); | ||
| // const m = /[^\s]*github\.com[/:]([^/]+)\/([^ ]+)[^\s]*/.exec(url); | ||
| const m = new RegExp(`[^\s]*${this.getURL()}[/:]([^/]+)\/([^ ]+)[^\s]*`).exec(url); |
There was a problem hiding this comment.
Backslashes need escaping in the string. Slashes don't. The URL might need some escaping too. Maybe (please check):
const m = new RegExp(`[^\\s]*${this.getURL().replace(/\./g, '\\.')}[/:]([^/]+)/([^ ]+)[^\\s]*`).exec(url);
src/github-issues-prs.ts
Outdated
| } | ||
|
|
||
| private getURL() { | ||
| if(this.host === undefined){ |
There was a problem hiding this comment.
Shouldn't that always be defined?
src/github-issues-prs.ts
Outdated
| let remote = remotes[`${owner}/${repo}`]; | ||
| if (!remote) { | ||
| const url = `https://github.com/${owner}/${repo}.git`; | ||
| const url = `${this.host}/${owner}/${repo}.git`; |
There was a problem hiding this comment.
Should that keep the https?
|
@chrmarti Thank you for review. |
chrmarti
left a comment
There was a problem hiding this comment.
Thanks for the update. I've added a few more comments.
src/github-issues-prs.ts
Outdated
| const item = issue.item; | ||
| const assignee = issue.query.assignee; | ||
| const url = `https://github.com/${issue.query.remote.owner}/${issue.query.remote.repo}/issues?q=is%3Aopen+milestone%3A%22${item.milestone.title}%22${assignee ? '+assignee%3A' + assignee : ''}`; | ||
| const url = `https://${this.getURL}/${issue.query.remote.owner}/${issue.query.remote.repo}/issues?q=is%3Aopen+milestone%3A%22${item.milestone.title}%22${assignee ? '+assignee%3A' + assignee : ''}`; |
src/github-issues-prs.ts
Outdated
| } | ||
|
|
||
| private getAPIOption() { | ||
| if (this.host === "github.com") { |
There was a problem hiding this comment.
Could you use single quotes ' instead of double quotes? Just for consistency with the rest of the code.
src/github-issues-prs.ts
Outdated
| const { stdout } = await exec('git remote -v', { cwd: folder.uri.fsPath }); | ||
| for (const url of new Set(allMatches(/^[^\s]+\s+([^\s]+)/gm, stdout, 1))) { | ||
| const m = /[^\s]*github\.com[/:]([^/]+)\/([^ ]+)[^\s]*/.exec(url); | ||
| const m = new RegExp(`[^\s]*${this.getURL().replace(/\./g, '\\.')}[/:]([^/]+)\/([^ ]+)[^\s]*`).exec(url); |
There was a problem hiding this comment.
I think the \s still need escaping as \\s, don't they? That's because it is in a string and not in a regex anymore.
There was a problem hiding this comment.
I missed it. Thank you
| let remote = remotes[`${owner}/${repo}`]; | ||
| if (!remote) { | ||
| const url = `https://github.com/${owner}/${repo}.git`; | ||
| const url = `https://${this.host}/${owner}/${repo}.git`; |
There was a problem hiding this comment.
Does this not need the encoding of getURL()? Do you have an example of when the encoding is needed?
There was a problem hiding this comment.
e.g. Thyme &time=again to comment=Thyme%20&time=again.
However, I think host name doesn't have space.
I'll remove this. Thank you.
| "default": [], | ||
| "description": "A list of repositories to query for issues." | ||
| }, | ||
| "github.host": { |
|
I haven't done any vs code extension development before, what's the best and/or easiest way for me to test this out? Do we pass around vsix files or something? |
|
@mikehaas763 You could checkout this PR from @Ikuyadeu's repo and open it in VS Code. Then run |
|
Thanks @Ikuyadeu LGTM! I'll merge this even before it is tested so we don't run into merge conflicts with other changes. |
|
@Ikuyadeu I missed giving you credit in the 1.19 release notes due to being on vacation. Sorry about that. I will do so in the 1.20 release notes. Thanks again! |
|
@chrmarti OK! Thank you too! |
It's one idea to fix #25.
And, If you use GitHubAPI, this change has no effect.