Skip to content

Open created issues in editor instead of browser #7046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/issues/issueFeatureRegistrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { OctokitCommon } from '../github/common';
import { FolderRepositoryManager, PullRequestDefaults } from '../github/folderRepositoryManager';
import { IProject } from '../github/interface';
import { IssueModel } from '../github/issueModel';
import { IssueOverviewPanel } from '../github/issueOverview';
import { RepositoriesManager } from '../github/repositoriesManager';
import { ISSUE_OR_URL_EXPRESSION, parseIssueExpressionOutput } from '../github/utils';
import { chatCommand } from '../lm/utils';
Expand Down Expand Up @@ -1268,10 +1269,11 @@ ${options?.body ?? ''}\n
if (!folderManager) {
return false;
}
const constFolderManager: FolderRepositoryManager = folderManager;
progress.report({ message: vscode.l10n.t('Verifying that issue data is valid...') });
try {
if (!origin) {
origin = await folderManager.getPullRequestDefaults();
origin = await constFolderManager.getPullRequestDefaults();
}
} catch (e) {
// There is no remote
Expand All @@ -1292,11 +1294,11 @@ ${options?.body ?? ''}\n
milestone
};

if (!(await this.verifyLabels(folderManager, createParams))) {
if (!(await this.verifyLabels(constFolderManager, createParams))) {
return false;
}
progress.report({ message: vscode.l10n.t('Creating issue in {0}...', `${createParams.owner}/${createParams.repo}`) });
const issue = await folderManager.createIssue(createParams);
const issue = await constFolderManager.createIssue(createParams);
if (issue) {
if (projects) {
await issue.updateProjects(projects);
Expand All @@ -1312,14 +1314,14 @@ ${options?.body ?? ''}\n
await vscode.workspace.applyEdit(edit);
} else {
const copyIssueUrl = vscode.l10n.t('Copy Issue Link');
const openIssue = vscode.l10n.t({ message: 'Open Issue', comment: 'Open the issue description in the browser to see it\'s full contents.' });
const openIssue = vscode.l10n.t({ message: 'Open Issue', comment: 'Open the issue description in the editor to see it\'s full contents.' });
vscode.window.showInformationMessage(vscode.l10n.t('Issue created'), copyIssueUrl, openIssue).then(async result => {
switch (result) {
case copyIssueUrl:
await vscode.env.clipboard.writeText(issue.html_url);
break;
case openIssue:
await vscode.env.openExternal(vscode.Uri.parse(issue.html_url));
await IssueOverviewPanel.createOrShow(this.telemetry, this.context.extensionUri, constFolderManager, issue);
break;
}
});
Expand Down