Skip to content

Commit 9034897

Browse files
committed
Merge branch 'main' into tyriar/156179-options
2 parents 20bd4a9 + 380647c commit 9034897

File tree

129 files changed

+2138
-911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+2138
-911
lines changed

.vscode/notebooks/endgame.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "$REPOS=repo:microsoft/vscode repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-dev repo:microsoft/vscode-js-debug repo:microsoft/vscode-remote-release repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-remotehub repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-livepreview repo:microsoft/vscode-python repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-unpkg\n\n$MILESTONE=milestone:\"July 2022\""
10+
"value": "$REPOS=repo:microsoft/vscode repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-dev repo:microsoft/vscode-js-debug repo:microsoft/vscode-remote-release repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-remotehub repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-livepreview repo:microsoft/vscode-python repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-unpkg\n\n$MILESTONE=milestone:\"August 2022\""
1111
},
1212
{
1313
"kind": 1,

.vscode/notebooks/my-endgame.github-issues

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"kind": 2,
99
"language": "github-issues",
10-
"value": "$REPOS=repo:microsoft/vscode repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-dev repo:microsoft/vscode-js-debug repo:microsoft/vscode-remote-release repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-remotehub repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-livepreview repo:microsoft/vscode-python repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal\n\n$MILESTONE=milestone:\"July 2022\"\n\n$MINE=assignee:@me"
10+
"value": "$REPOS=repo:microsoft/vscode repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-dev repo:microsoft/vscode-js-debug repo:microsoft/vscode-remote-release repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-remotehub repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-livepreview repo:microsoft/vscode-python repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal\r\n\r\n$MILESTONE=milestone:\"August 2022\"\r\n\r\n$MINE=assignee:@me"
1111
},
1212
{
1313
"kind": 1,

build/filters.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module.exports.unicodeFilter = [
3939
'!**/test/**',
4040
'!**/*.test.ts',
4141
'!**/*.{d.ts,json,md}',
42+
'!**/*.mp3',
4243

4344
'!build/win32/**',
4445
'!extensions/markdown-language-features/notebook-out/*.js',
@@ -65,6 +66,7 @@ module.exports.indentationFilter = [
6566
'!**/LICENSE.{txt,rtf}',
6667
'!LICENSES.chromium.html',
6768
'!**/LICENSE',
69+
'!**/*.mp3',
6870
'!src/vs/loader.js',
6971
'!src/vs/base/browser/dompurify/*',
7072
'!src/vs/base/common/marked/marked.js',
@@ -135,6 +137,7 @@ module.exports.copyrightFilter = [
135137
'!**/*.cmd',
136138
'!**/*.ico',
137139
'!**/*.opus',
140+
'!**/*.mp3',
138141
'!**/*.icns',
139142
'!**/*.xml',
140143
'!**/*.sh',

build/gulpfile.vscode.js

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ const minimist = require('minimist');
3434
const { compileBuildTask } = require('./gulpfile.compile');
3535
const { compileExtensionsBuildTask, compileExtensionMediaBuildTask } = require('./gulpfile.extensions');
3636
const { getSettingsSearchBuildId, shouldSetupSettingsSearch } = require('./azure-pipelines/upload-configuration');
37+
const { promisify } = require('util');
38+
const glob = promisify(require('glob'));
39+
const rcedit = promisify(require('rcedit'));
3740

3841
// Build
3942
const vscodeEntryPoints = _.flatten([
@@ -56,7 +59,7 @@ const vscodeResources = [
5659
'out-build/bootstrap-amd.js',
5760
'out-build/bootstrap-node.js',
5861
'out-build/bootstrap-window.js',
59-
'out-build/vs/**/*.{svg,png,html,jpg,opus}',
62+
'out-build/vs/**/*.{svg,png,html,jpg,mp3}',
6063
'!out-build/vs/code/browser/**/*.html',
6164
'!out-build/vs/editor/standalone/**/*.svg',
6265
'out-build/vs/base/common/performance.js',
@@ -347,6 +350,35 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
347350
};
348351
}
349352

353+
function patchWin32DependenciesTask(destinationFolderName) {
354+
const cwd = path.join(path.dirname(root), destinationFolderName);
355+
356+
return async () => {
357+
const deps = await glob('**/*.node', { cwd });
358+
const packageJson = JSON.parse(await fs.promises.readFile(path.join(cwd, 'resources', 'app', 'package.json'), 'utf8'));
359+
const product = JSON.parse(await fs.promises.readFile(path.join(cwd, 'resources', 'app', 'product.json'), 'utf8'));
360+
const baseVersion = packageJson.version.replace(/-.*$/, '');
361+
362+
await Promise.all(deps.map(async dep => {
363+
const basename = path.basename(dep);
364+
365+
await rcedit(path.join(cwd, dep), {
366+
'file-version': baseVersion,
367+
'version-string': {
368+
'CompanyName': 'Microsoft Corporation',
369+
'FileDescription': product.nameLong,
370+
'FileVersion': packageJson.version,
371+
'InternalName': basename,
372+
'LegalCopyright': 'Copyright (C) 2022 Microsoft. All rights reserved',
373+
'OriginalFilename': basename,
374+
'ProductName': product.nameLong,
375+
'ProductVersion': packageJson.version,
376+
}
377+
});
378+
}));
379+
};
380+
}
381+
350382
const buildRoot = path.dirname(root);
351383

352384
const BUILD_TARGETS = [
@@ -370,10 +402,16 @@ BUILD_TARGETS.forEach(buildTarget => {
370402
const sourceFolderName = `out-vscode${dashed(minified)}`;
371403
const destinationFolderName = `VSCode${dashed(platform)}${dashed(arch)}`;
372404

373-
const vscodeTaskCI = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series(
405+
const tasks = [
374406
util.rimraf(path.join(buildRoot, destinationFolderName)),
375407
packageTask(platform, arch, sourceFolderName, destinationFolderName, opts)
376-
));
408+
];
409+
410+
if (platform === 'win32') {
411+
tasks.push(patchWin32DependenciesTask(destinationFolderName));
412+
}
413+
414+
const vscodeTaskCI = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}-ci`, task.series(...tasks));
377415
gulp.task(vscodeTaskCI);
378416

379417
const vscodeTask = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}`, task.series(

build/gulpfile.vscode.web.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const version = (quality && quality !== 'stable') ? `${packageJson.version}-${qu
3232

3333
const vscodeWebResourceIncludes = [
3434
// Workbench
35-
'out-build/vs/{base,platform,editor,workbench}/**/*.{svg,png,jpg,opus}',
35+
'out-build/vs/{base,platform,editor,workbench}/**/*.{svg,png,jpg,mp3}',
3636
'out-build/vs/code/browser/workbench/*.html',
3737
'out-build/vs/base/browser/ui/codicons/codicon/**/*.ttf',
3838
'out-build/vs/**/markdown.css',

extensions/git/package.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
1212
"enabledApiProposals": [
1313
"diffCommand",
14-
"contribMergeEditorToolbar",
14+
"contribEditorContentMenu",
1515
"contribViewsWelcome",
16+
"editSessionIdentityProvider",
1617
"scmActionButton",
1718
"scmSelectedProvider",
1819
"scmValidation",
@@ -24,6 +25,7 @@
2425
],
2526
"activationEvents": [
2627
"*",
28+
"onEditSession:file",
2729
"onFileSystem:git",
2830
"onFileSystem:git-show"
2931
],
@@ -1512,11 +1514,6 @@
15121514
"group": "navigation",
15131515
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && !isInDiffEditor && !isMergeEditor && resourceScheme == file && scmActiveResourceHasChanges"
15141516
},
1515-
{
1516-
"command": "git.openMergeEditor",
1517-
"group": "navigation@-10",
1518-
"when": "config.git.enabled && !git.missing && !isInDiffEditor && !isMergeEditor && resource in git.mergeChanges"
1519-
},
15201517
{
15211518
"command": "git.commitMessageAccept",
15221519
"group": "navigation",
@@ -1560,10 +1557,15 @@
15601557
"when": "isInDiffRightEditor && !isInEmbeddedDiffEditor && config.git.enabled && !git.missing && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
15611558
}
15621559
],
1563-
"merge/toolbar": [
1560+
"editor/content": [
15641561
{
15651562
"command": "git.acceptMerge",
1566-
"when": "isMergeEditor && mergeEditorBaseUri =~ /^(git|file):/ && mergeEditorResultUri in git.mergeChanges"
1563+
"when": "isMergeResultEditor && mergeEditorBaseUri =~ /^(git|file):/ && mergeEditorResultUri in git.mergeChanges"
1564+
},
1565+
{
1566+
"command": "git.openMergeEditor",
1567+
"group": "navigation@-10",
1568+
"when": "config.git.enabled && !git.missing && !isInDiffEditor && !isMergeEditor && resource in git.mergeChanges"
15671569
}
15681570
],
15691571
"scm/change/title": [
@@ -2190,6 +2192,12 @@
21902192
"scope": "resource",
21912193
"default": "none"
21922194
},
2195+
"git.rememberPostCommitCommand": {
2196+
"type": "boolean",
2197+
"description": "%config.rememberPostCommitCommand%",
2198+
"scope": "resource",
2199+
"default": false
2200+
},
21932201
"git.openAfterClone": {
21942202
"type": "string",
21952203
"enum": [

extensions/git/package.nls.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@
163163
"config.promptToSaveFilesBeforeCommit.always": "Check for any unsaved files.",
164164
"config.promptToSaveFilesBeforeCommit.staged": "Check only for unsaved staged files.",
165165
"config.promptToSaveFilesBeforeCommit.never": "Disable this check.",
166-
"config.postCommitCommand": "Runs a git command after a successful commit.",
166+
"config.postCommitCommand": "Run a git command after a successful commit.",
167167
"config.postCommitCommand.none": "Don't run any command after a commit.",
168-
"config.postCommitCommand.push": "Run 'Git Push' after a successful commit.",
169-
"config.postCommitCommand.sync": "Run 'Git Sync' after a successful commit.",
168+
"config.postCommitCommand.push": "Run 'git push' after a successful commit.",
169+
"config.postCommitCommand.sync": "Run 'git pull' and 'git push' after a successful commit.",
170+
"config.rememberPostCommitCommand": "Remember the last git command that ran after a commit.",
170171
"config.openAfterClone": "Controls whether to open a repository automatically after cloning.",
171172
"config.openAfterClone.always": "Always open in current window.",
172173
"config.openAfterClone.alwaysNewWindow": "Always open in a new window.",

extensions/git/src/actionButton.ts

Lines changed: 22 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55

66
import * as nls from 'vscode-nls';
77
import { Command, Disposable, Event, EventEmitter, SourceControlActionButton, Uri, workspace } from 'vscode';
8-
import { ApiRepository } from './api/api1';
9-
import { Branch, Status } from './api/git';
10-
import { IPostCommitCommandsProviderRegistry } from './postCommitCommands';
8+
import { Branch, CommitCommand, Status } from './api/git';
9+
import { CommitCommandsCenter } from './postCommitCommands';
1110
import { Repository, Operation } from './repository';
1211
import { dispose } from './util';
1312

@@ -39,7 +38,7 @@ export class ActionButtonCommand {
3938

4039
constructor(
4140
readonly repository: Repository,
42-
readonly postCommitCommandsProviderRegistry: IPostCommitCommandsProviderRegistry) {
41+
readonly postCommitCommandCenter: CommitCommandsCenter) {
4342
this._state = {
4443
HEAD: undefined,
4544
isCommitInProgress: false,
@@ -52,7 +51,7 @@ export class ActionButtonCommand {
5251
repository.onDidRunGitStatus(this.onDidRunGitStatus, this, this.disposables);
5352
repository.onDidChangeOperations(this.onDidChangeOperations, this, this.disposables);
5453

55-
this.disposables.push(postCommitCommandsProviderRegistry.onDidChangePostCommitCommandsProviders(() => this._onDidChange.fire()));
54+
this.disposables.push(postCommitCommandCenter.onDidChange(() => this._onDidChange.fire()));
5655

5756
const root = Uri.file(repository.root);
5857
this.disposables.push(workspace.onDidChangeConfiguration(e => {
@@ -65,6 +64,7 @@ export class ActionButtonCommand {
6564
if (e.affectsConfiguration('git.branchProtection', root) ||
6665
e.affectsConfiguration('git.branchProtectionPrompt', root) ||
6766
e.affectsConfiguration('git.postCommitCommand', root) ||
67+
e.affectsConfiguration('git.rememberPostCommitCommand', root) ||
6868
e.affectsConfiguration('git.showActionButton', root)) {
6969
this._onDidChange.fire();
7070
}
@@ -92,14 +92,17 @@ export class ActionButtonCommand {
9292
// The button is disabled
9393
if (!showActionButton.commit) { return undefined; }
9494

95+
const primaryCommand = this.getCommitActionButtonPrimaryCommand();
96+
9597
return {
96-
command: this.getCommitActionButtonPrimaryCommand(),
98+
command: primaryCommand,
9799
secondaryCommands: this.getCommitActionButtonSecondaryCommands(),
100+
description: primaryCommand.description ?? primaryCommand.title,
98101
enabled: (this.state.repositoryHasChangesToCommit || this.state.isRebaseInProgress) && !this.state.isCommitInProgress && !this.state.isMergeInProgress
99102
};
100103
}
101104

102-
private getCommitActionButtonPrimaryCommand(): Command {
105+
private getCommitActionButtonPrimaryCommand(): CommitCommand {
103106
// Rebase Continue
104107
if (this.state.isRebaseInProgress) {
105108
return {
@@ -111,87 +114,22 @@ export class ActionButtonCommand {
111114
}
112115

113116
// Commit
114-
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
115-
const postCommitCommand = config.get<string>('postCommitCommand');
116-
117-
// Branch protection
118-
const isBranchProtected = this.repository.isBranchProtected();
119-
const branchProtectionPrompt = config.get<'alwaysCommit' | 'alwaysCommitToNewBranch' | 'alwaysPrompt'>('branchProtectionPrompt')!;
120-
const alwaysPrompt = isBranchProtected && branchProtectionPrompt === 'alwaysPrompt';
121-
const alwaysCommitToNewBranch = isBranchProtected && branchProtectionPrompt === 'alwaysCommitToNewBranch';
122-
123-
// Icon
124-
const icon = alwaysPrompt ? '$(lock)' : alwaysCommitToNewBranch ? '$(git-branch)' : undefined;
125-
126-
let commandArg = '';
127-
let title = localize('scm button commit title', "{0} Commit", icon ?? '$(check)');
128-
let tooltip = this.state.isCommitInProgress ? localize('scm button committing tooltip', "Committing Changes...") : localize('scm button commit tooltip', "Commit Changes");
129-
130-
// Title, tooltip
131-
switch (postCommitCommand) {
132-
case 'push': {
133-
commandArg = 'git.push';
134-
title = localize('scm button commit and push title', "{0} Commit & Push", icon ?? '$(arrow-up)');
135-
if (alwaysCommitToNewBranch) {
136-
tooltip = this.state.isCommitInProgress ?
137-
localize('scm button committing to new branch and pushing tooltip', "Committing to New Branch & Pushing Changes...") :
138-
localize('scm button commit to new branch and push tooltip', "Commit to New Branch & Push Changes");
139-
} else {
140-
tooltip = this.state.isCommitInProgress ?
141-
localize('scm button committing and pushing tooltip', "Committing & Pushing Changes...") :
142-
localize('scm button commit and push tooltip', "Commit & Push Changes");
143-
}
144-
break;
145-
}
146-
case 'sync': {
147-
commandArg = 'git.sync';
148-
title = localize('scm button commit and sync title', "{0} Commit & Sync", icon ?? '$(sync)');
149-
if (alwaysCommitToNewBranch) {
150-
tooltip = this.state.isCommitInProgress ?
151-
localize('scm button committing to new branch and synching tooltip', "Committing to New Branch & Synching Changes...") :
152-
localize('scm button commit to new branch and sync tooltip', "Commit to New Branch & Sync Changes");
153-
} else {
154-
tooltip = this.state.isCommitInProgress ?
155-
localize('scm button committing and synching tooltip', "Committing & Synching Changes...") :
156-
localize('scm button commit and sync tooltip', "Commit & Sync Changes");
157-
}
158-
break;
159-
}
160-
default: {
161-
if (alwaysCommitToNewBranch) {
162-
tooltip = this.state.isCommitInProgress ?
163-
localize('scm button committing to new branch tooltip', "Committing Changes to New Branch...") :
164-
localize('scm button commit to new branch tooltip', "Commit Changes to New Branch");
165-
}
166-
break;
167-
}
168-
}
169-
170-
return { command: 'git.commit', title, tooltip, arguments: [this.repository.sourceControl, commandArg] };
117+
return this.postCommitCommandCenter.getPrimaryCommand();
171118
}
172119

173120
private getCommitActionButtonSecondaryCommands(): Command[][] {
174-
const commandGroups: Command[][] = [];
175-
176-
if (!this.state.isRebaseInProgress) {
177-
for (const provider of this.postCommitCommandsProviderRegistry.getPostCommitCommandsProviders()) {
178-
const commands = provider.getCommands(new ApiRepository(this.repository));
179-
commandGroups.push((commands ?? []).map(c => {
180-
return {
181-
command: 'git.commit',
182-
title: c.title,
183-
arguments: [this.repository.sourceControl, c.command]
184-
};
185-
}));
186-
}
121+
// Rebase Continue
122+
if (this.state.isRebaseInProgress) {
123+
return [];
124+
}
187125

188-
if (commandGroups.length > 0) {
189-
commandGroups[0].splice(0, 0, {
190-
command: 'git.commit',
191-
title: localize('scm secondary button commit', "Commit"),
192-
arguments: [this.repository.sourceControl, '']
193-
});
194-
}
126+
// Commit
127+
const commandGroups: Command[][] = [];
128+
for (const commands of this.postCommitCommandCenter.getSecondaryCommands()) {
129+
commandGroups.push(commands.map(c => {
130+
// Use the description as title if present
131+
return { command: 'git.commit', title: c.description ?? c.title, tooltip: c.tooltip, arguments: c.arguments };
132+
}));
195133
}
196134

197135
return commandGroups;

extensions/git/src/api/git.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ export interface CredentialsProvider {
254254
getCredentials(host: Uri): ProviderResult<Credentials>;
255255
}
256256

257+
export type CommitCommand = Command & { description?: string };
258+
257259
export interface PostCommitCommandsProvider {
258-
getCommands(repository: Repository): Command[];
260+
getCommands(repository: Repository): CommitCommand[];
259261
}
260262

261263
export interface PushErrorHandler {

extensions/git/src/commands.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,20 +1635,6 @@ export class CommandCenter {
16351635

16361636
await repository.commit(message, opts);
16371637

1638-
// Execute post-commit command
1639-
let postCommitCommand = opts.postCommitCommand;
1640-
1641-
if (postCommitCommand === undefined) {
1642-
// Commit WAS NOT initiated using the action button (ex: keybinding, toolbar
1643-
// action, command palette) so we honour the `git.postCommitCommand` setting.
1644-
const postCommitCommandSetting = config.get<string>('postCommitCommand');
1645-
postCommitCommand = postCommitCommandSetting === 'push' || postCommitCommandSetting === 'sync' ? `git.${postCommitCommandSetting}` : '';
1646-
}
1647-
1648-
if (postCommitCommand.length) {
1649-
await commands.executeCommand(postCommitCommand, new ApiRepository(repository));
1650-
}
1651-
16521638
return true;
16531639
}
16541640

0 commit comments

Comments
 (0)