Skip to content
Draft
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@
"default": "number",
"description": "%githubIssues.createInsertFormat.description%"
},
"githubIssues.assignToMeOnCreate": {
"type": "boolean",
"default": false,
"description": "%githubIssues.assignToMeOnCreate.description%"
},
"githubIssues.issueCompletions.enabled": {
"type": "boolean",
"default": true,
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"githubIssues.createIssueTriggers.items": "String that enables the 'Create issue from comment' code action. Should not contain whitespace.",
"githubPullRequests.codingAgent.codeLens.description": "Show the 'Delegate to agent' CodeLens actions above TODO comments for delegating to coding agent.",
"githubIssues.createInsertFormat.description": "Controls whether an issue number (ex. #1234) or a full url (ex. https://github.com/owner/name/issues/1234) is inserted when the Create Issue code action is run.",
"githubIssues.assignToMeOnCreate.description": "When enabled, automatically assigns new issues created from TODO/FIXME comments to yourself.",
"githubIssues.issueCompletions.enabled.description": "Controls whether completion suggestions are shown for issues.",
"githubIssues.userCompletions.enabled.description": "Controls whether completion suggestions are shown for users.",
"githubIssues.ignoreCompletionTrigger.description": "Languages that the '#' character should not be used to trigger issue completion suggestions.",
Expand Down
1 change: 1 addition & 0 deletions src/common/settingKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const USER_COMPLETIONS = 'userCompletions';
export const ENABLED = 'enabled';
export const IGNORE_USER_COMPLETION_TRIGGER = 'ignoreUserCompletionTrigger';
export const CREATE_INSERT_FORMAT = 'createInsertFormat';
export const ASSIGN_TO_ME_ON_CREATE = 'assignToMeOnCreate';
export const ISSUE_BRANCH_TITLE = 'issueBranchTitle';
export const USE_BRANCH_FOR_ISSUES = 'useBranchForIssues';
export const WORKING_ISSUE_FORMAT_SCM = 'workingIssueFormatScm';
Expand Down
27 changes: 27 additions & 0 deletions src/issues/issueFeatureRegistrar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Disposable } from '../common/lifecycle';
import Logger from '../common/logger';
import {
ALWAYS_PROMPT_FOR_NEW_ISSUE_REPO,
ASSIGN_TO_ME_ON_CREATE,
CREATE_INSERT_FORMAT,
ENABLED,
ISSUE_COMPLETIONS,
Expand Down Expand Up @@ -1000,6 +1001,32 @@ export class IssueFeatureRegistrar extends Disposable {
if (matches && matches.length === 2 && (await this._stateManager.getUserMap(document.uri)).has(matches[1])) {
assignees = [matches[1]];
}

// Check if we should auto-assign to the current user
const assignToMe = vscode.workspace.getConfiguration(ISSUES_SETTINGS_NAMESPACE).get<boolean>(ASSIGN_TO_ME_ON_CREATE, false);
if (assignToMe) {
// Get the folder manager to access the current user
const folderManager = this.manager.getManagerForFile(document.uri);
if (folderManager) {
try {
// Get the GitHub repository for the document to ensure we get the correct user
const githubRepository = folderManager.gitHubRepositories[0];
const currentUser = await folderManager.getCurrentUser(githubRepository);
if (currentUser?.login) {
// Add current user to assignees if not already included
if (!assignees) {
assignees = [currentUser.login];
} else if (!assignees.includes(currentUser.login)) {
assignees.push(currentUser.login);
}
}
} catch (error) {
// If we can't get the current user, just continue without auto-assignment
Logger.debug('Failed to get current user for auto-assignment', IssueFeatureRegistrar.ID, error);
}
}
}

let title: string | undefined;
const body: string | undefined = await this.createTodoIssueBody(newIssue, issueBody);

Expand Down