Skip to content

Commit 73d4c39

Browse files
committed
Merge branch 'main' into merogge/inline-chat-revamp
2 parents 9c71530 + 77196de commit 73d4c39

File tree

99 files changed

+1281
-626
lines changed

Some content is hidden

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

99 files changed

+1281
-626
lines changed

.vscode/launch.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
"version": "0.1.0",
33
"configurations": [
4-
{
5-
"request": "attach",
6-
"type": "node",
7-
""
8-
},
94
{
105
"type": "node",
116
"request": "launch",
@@ -247,6 +242,7 @@
247242
"--crash-reporter-directory=${workspaceFolder}/.profile-oss/crashes",
248243
// for general runtime freezes: https://github.com/microsoft/vscode/issues/127861#issuecomment-904144910
249244
"--disable-features=CalculateNativeWinOcclusion",
245+
"--disable-extension=vscode.vscode-api-tests"
250246
],
251247
"webRoot": "${workspaceFolder}",
252248
"cascadeTerminateToConfigurations": [

build/azure-pipelines/darwin/product-build-darwin.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,3 @@ steps:
231231
Write-Host "##vso[task.setvariable variable=AZURE_TENANT_ID]$env:tenantId"
232232
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_ID]$env:servicePrincipalId"
233233
Write-Host "##vso[task.setvariable variable=AZURE_CLIENT_SECRET;issecret=true]$env:servicePrincipalKey"
234-
235-
- script: |
236-
set -e
237-
AZURE_STORAGE_ACCOUNT="ticino" \
238-
AZURE_TENANT_ID="$(AZURE_TENANT_ID)" \
239-
AZURE_CLIENT_ID="$(AZURE_CLIENT_ID)" \
240-
AZURE_CLIENT_SECRET="$(AZURE_CLIENT_SECRET)" \
241-
VSCODE_ARCH="$(VSCODE_ARCH)" \
242-
node build/azure-pipelines/upload-configuration
243-
displayName: Upload configuration (for Bing settings search)
244-
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
245-
continueOnError: true

build/azure-pipelines/upload-configuration.ts

Lines changed: 0 additions & 129 deletions
This file was deleted.

build/gulpfile.vscode.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const createAsar = require('./lib/asar').createAsar;
3333
const minimist = require('minimist');
3434
const { compileBuildTask } = require('./gulpfile.compile');
3535
const { compileExtensionsBuildTask, compileExtensionMediaBuildTask } = require('./gulpfile.extensions');
36-
const { getSettingsSearchBuildId, shouldSetupSettingsSearch } = require('./azure-pipelines/upload-configuration');
3736
const { promisify } = require('util');
3837
const glob = promisify(require('glob'));
3938
const rcedit = promisify(require('rcedit'));
@@ -254,10 +253,6 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
254253
const date = new Date().toISOString();
255254
const productJsonUpdate = { commit, date, checksums, version };
256255

257-
if (shouldSetupSettingsSearch()) {
258-
productJsonUpdate.settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
259-
}
260-
261256
const productJsonStream = gulp.src(['product.json'], { base: '.' })
262257
.pipe(json(productJsonUpdate));
263258

build/monaco/monaco.d.ts.recipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ declare namespace monaco {
3636
/**
3737
* Create a trusted types policy (same API as window.trustedTypes.createPolicy)
3838
*/
39-
createTrustedTypesPolicy(
39+
createTrustedTypesPolicy?(
4040
policyName: string,
4141
policyOptions?: ITrustedTypePolicyOptions,
4242
): undefined | ITrustedTypePolicy;

extensions/github/src/commands.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,25 @@ import { LinkContext, getLink, getVscodeDevHost } from './links';
1111

1212
async function copyVscodeDevLink(gitAPI: GitAPI, useSelection: boolean, context: LinkContext, includeRange = true) {
1313
try {
14-
const permalink = getLink(gitAPI, useSelection, getVscodeDevHost(), 'headlink', context, includeRange);
14+
const permalink = await getLink(gitAPI, useSelection, getVscodeDevHost(), 'headlink', context, includeRange);
1515
if (permalink) {
1616
return vscode.env.clipboard.writeText(permalink);
1717
}
1818
} catch (err) {
19-
vscode.window.showErrorMessage(err.message);
19+
if (!(err instanceof vscode.CancellationError)) {
20+
vscode.window.showErrorMessage(err.message);
21+
}
2022
}
2123
}
2224

2325
async function openVscodeDevLink(gitAPI: GitAPI): Promise<vscode.Uri | undefined> {
2426
try {
25-
const headlink = getLink(gitAPI, true, getVscodeDevHost(), 'headlink');
27+
const headlink = await getLink(gitAPI, true, getVscodeDevHost(), 'headlink');
2628
return headlink ? vscode.Uri.parse(headlink) : undefined;
2729
} catch (err) {
28-
vscode.window.showErrorMessage(err.message);
30+
if (!(err instanceof vscode.CancellationError)) {
31+
vscode.window.showErrorMessage(err.message);
32+
}
2933
return undefined;
3034
}
3135
}

extensions/github/src/links.ts

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
7-
import { API as GitAPI, Repository } from './typings/git';
7+
import { API as GitAPI, RefType, Repository } from './typings/git';
88
import { getRepositoryFromUrl } from './util';
99

1010
export function isFileInRepo(repository: Repository, file: vscode.Uri): boolean {
@@ -129,7 +129,7 @@ export function encodeURIComponentExceptSlashes(path: string) {
129129
return path.split('/').map((segment) => encodeURIComponent(segment)).join('/');
130130
}
131131

132-
export function getLink(gitAPI: GitAPI, useSelection: boolean, hostPrefix?: string, linkType: 'permalink' | 'headlink' = 'permalink', context?: LinkContext, useRange?: boolean): string | undefined {
132+
export async function getLink(gitAPI: GitAPI, useSelection: boolean, hostPrefix?: string, linkType: 'permalink' | 'headlink' = 'permalink', context?: LinkContext, useRange?: boolean): Promise<string | undefined> {
133133
hostPrefix = hostPrefix ?? 'https://github.com';
134134
const fileAndPosition = getFileAndPosition(context);
135135
if (!fileAndPosition) {
@@ -142,6 +142,9 @@ export function getLink(gitAPI: GitAPI, useSelection: boolean, hostPrefix?: stri
142142
if (!gitRepo) {
143143
return;
144144
}
145+
146+
await ensurePublished(gitRepo, uri);
147+
145148
let repo: { owner: string; repo: string } | undefined;
146149
gitRepo.state.remotes.find(remote => {
147150
if (remote.fetchUrl) {
@@ -182,3 +185,54 @@ export function getBranchLink(url: string, branch: string, hostPrefix: string =
182185
export function getVscodeDevHost(): string {
183186
return `https://${vscode.env.appName.toLowerCase().includes('insiders') ? 'insiders.' : ''}vscode.dev/github`;
184187
}
188+
189+
export async function ensurePublished(repository: Repository, file: vscode.Uri) {
190+
if ((repository.state.HEAD?.type === RefType.Head || repository.state.HEAD?.type === RefType.Tag)
191+
// If HEAD is not published, make sure it is
192+
&& !repository?.state.HEAD?.upstream
193+
) {
194+
const publishBranch = vscode.l10n.t('Publish Branch');
195+
const selection = await vscode.window.showInformationMessage(
196+
vscode.l10n.t('The current branch is not published to the remote. Would you like to publish your branch before copying a link?'),
197+
{ modal: true },
198+
publishBranch
199+
);
200+
if (selection !== publishBranch) {
201+
throw new vscode.CancellationError();
202+
}
203+
204+
await vscode.commands.executeCommand('git.publish');
205+
}
206+
207+
const uncommittedChanges = [...repository.state.workingTreeChanges, ...repository.state.indexChanges];
208+
if (uncommittedChanges.find((c) => c.uri.toString() === file.toString())) {
209+
const commitChanges = vscode.l10n.t('Commit Changes');
210+
const copyAnyway = vscode.l10n.t('Copy Anyway');
211+
const selection = await vscode.window.showWarningMessage(
212+
vscode.l10n.t('The current file has uncommitted changes. Please commit your changes before copying a link.'),
213+
{ modal: true },
214+
commitChanges,
215+
copyAnyway
216+
);
217+
218+
if (selection !== copyAnyway) {
219+
// Focus the SCM view
220+
vscode.commands.executeCommand('workbench.view.scm');
221+
throw new vscode.CancellationError();
222+
}
223+
} else if (repository.state.HEAD?.ahead) {
224+
const pushCommits = vscode.l10n.t('Push Commits');
225+
const selection = await vscode.window.showInformationMessage(
226+
vscode.l10n.t('The current branch has unpublished commits. Would you like to push your commits before copying a link?'),
227+
{ modal: true },
228+
pushCommits
229+
);
230+
if (selection !== pushCommits) {
231+
throw new vscode.CancellationError();
232+
}
233+
234+
await repository.push();
235+
}
236+
237+
await repository.status();
238+
}

extensions/github/src/shareProviders.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as vscode from 'vscode';
77
import { API } from './typings/git';
88
import { getRepositoryFromUrl, repositoryHasGitHubRemote } from './util';
9-
import { encodeURIComponentExceptSlashes, getRepositoryForFile, notebookCellRangeString, rangeString } from './links';
9+
import { encodeURIComponentExceptSlashes, ensurePublished, getRepositoryForFile, notebookCellRangeString, rangeString } from './links';
1010

1111
export class VscodeDevShareProvider implements vscode.ShareProvider, vscode.Disposable {
1212
readonly id: string = 'copyVscodeDevLink';
@@ -63,12 +63,14 @@ export class VscodeDevShareProvider implements vscode.ShareProvider, vscode.Disp
6363
}
6464
}
6565

66-
provideShare(item: vscode.ShareableItem, _token: vscode.CancellationToken): vscode.ProviderResult<vscode.Uri> {
66+
async provideShare(item: vscode.ShareableItem, _token: vscode.CancellationToken): Promise<vscode.Uri | undefined> {
6767
const repository = getRepositoryForFile(this.gitAPI, item.resourceUri);
6868
if (!repository) {
6969
return;
7070
}
7171

72+
await ensurePublished(repository, item.resourceUri);
73+
7274
let repo: { owner: string; repo: string } | undefined;
7375
repository.state.remotes.find(remote => {
7476
if (remote.fetchUrl) {

extensions/typescript-language-features/src/extension.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<Api> {
7878
logDirectoryProvider: noopLogDirectoryProvider,
7979
cancellerFactory: noopRequestCancellerFactory,
8080
versionProvider,
81-
processFactory: new WorkerServerProcessFactory(context.extensionUri),
81+
processFactory: new WorkerServerProcessFactory(context.extensionUri, logger),
8282
activeJsTsEditorTracker,
8383
serviceConfigurationProvider: new BrowserServiceConfigurationProvider(),
8484
experimentTelemetryReporter,

extensions/typescript-language-features/src/languageFeatures/diagnostics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class DiagnosticsManager extends Disposable {
170170
public override dispose() {
171171
super.dispose();
172172

173-
for (const value of this._pendingUpdates.values) {
173+
for (const value of this._pendingUpdates.values()) {
174174
clearTimeout(value);
175175
}
176176
this._pendingUpdates.clear();
@@ -259,7 +259,7 @@ export class DiagnosticsManager extends Disposable {
259259

260260
private rebuildAll(): void {
261261
this._currentDiagnostics.clear();
262-
for (const fileDiagnostic of this._diagnostics.values) {
262+
for (const fileDiagnostic of this._diagnostics.values()) {
263263
this.rebuildFile(fileDiagnostic);
264264
}
265265
}

0 commit comments

Comments
 (0)