diff --git a/package.json b/package.json index 587d1b3ab1..507ab5ba6f 100644 --- a/package.json +++ b/package.json @@ -746,6 +746,11 @@ "default": "${issueTitle}\nFixes ${issueNumberLabel}", "markdownDescription": "%githubIssues.issueCompletionFormatScm.markdownDescription%" }, + "githubIssues.issueCompletionFormatEditor": { + "type": "string", + "default": "${issueNumberLabel}", + "markdownDescription": "%githubIssues.issueCompletionFormatEditor.markdownDescription%" + }, "githubIssues.workingIssueFormatScm": { "type": "string", "default": "${issueTitle} \nFixes ${issueNumberLabel}", diff --git a/package.nls.json b/package.nls.json index ea64843094..6e503ca7cf 100644 --- a/package.nls.json +++ b/package.nls.json @@ -157,6 +157,12 @@ "Do not translate what's inside of the ${...}. It is an internal syntax for the extension." ] }, + "githubIssues.issueCompletionFormatEditor.markdownDescription": { + "message": "Sets the format of issue completions in the editor. \n- `${user}` will be replaced with the currently logged in username \n- `${issueNumber}` will be replaced with the current issue number \n- `${issueNumberLabel}` will be replaced with a label formatted as #number or owner/repository#number, depending on whether the issue is in the current repository \n- `${issueTitle}` will be replaced with the issue title", + "comment": [ + "Do not translate what's inside of the ${...}. It is an internal syntax for the extension." + ] + }, "githubIssues.workingIssueFormatScm.markdownDescription": { "message": "Sets the format of the commit message that is set in the SCM inputbox when you **Start Working on an Issue**. Defaults to `${issueTitle} \nFixes ${issueNumberLabel}`", "comment": [ diff --git a/src/common/settingKeys.ts b/src/common/settingKeys.ts index 0f5e64399b..58076e212b 100644 --- a/src/common/settingKeys.ts +++ b/src/common/settingKeys.ts @@ -61,6 +61,7 @@ export const WORKING_BASE_BRANCH = 'workingBaseBranch'; export const WORKING_ISSUE_FORMAT_SCM = 'workingIssueFormatScm'; export const IGNORE_COMPLETION_TRIGGER = 'ignoreCompletionTrigger'; export const ISSUE_COMPLETION_FORMAT_SCM = 'issueCompletionFormatScm'; +export const ISSUE_COMPLETION_FORMAT_EDITOR = 'issueCompletionFormatEditor'; export const CREATE_ISSUE_TRIGGERS = 'createIssueTriggers'; export const DEFAULT = 'default'; export const IGNORE_MILESTONES = 'ignoreMilestones'; diff --git a/src/issues/issueCompletionProvider.ts b/src/issues/issueCompletionProvider.ts index 63bd4a527d..d2ccdcaaf7 100644 --- a/src/issues/issueCompletionProvider.ts +++ b/src/issues/issueCompletionProvider.ts @@ -6,6 +6,7 @@ import * as vscode from 'vscode'; import { IGNORE_COMPLETION_TRIGGER, + ISSUE_COMPLETION_FORMAT_EDITOR, ISSUE_COMPLETION_FORMAT_SCM, ISSUES_SETTINGS_NAMESPACE, } from '../common/settingKeys'; @@ -208,11 +209,15 @@ export class IssueCompletionProvider implements vscode.CompletionItemProvider { if (document.languageId === 'markdown') { item.insertText = `[${getIssueNumberLabel(issue, repo)}](${issue.html_url})`; } else { - const configuration = vscode.workspace + let completionFormatSetting = ISSUE_COMPLETION_FORMAT_EDITOR; + if (document.uri.path.match(/git\/scm\d\/input/)) { + completionFormatSetting = ISSUE_COMPLETION_FORMAT_SCM; + } + const completionFormat = vscode.workspace .getConfiguration(ISSUES_SETTINGS_NAMESPACE) - .get(ISSUE_COMPLETION_FORMAT_SCM); - if (document.uri.path.match(/git\/scm\d\/input/) && typeof configuration === 'string') { - item.insertText = variableSubstitution(configuration, issue, repo); + .get(completionFormatSetting); + if (typeof completionFormat === 'string') { + item.insertText = variableSubstitution(completionFormat, issue, repo); } else { item.insertText = `${getIssueNumberLabel(issue, repo)}`; }