Skip to content

Commit 54064e1

Browse files
authored
Merge branch 'main' into aamunger/dirtyNotebooks
2 parents 66b0f92 + b2ab524 commit 54064e1

File tree

11 files changed

+105
-88
lines changed

11 files changed

+105
-88
lines changed

extensions/git/src/commands.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,15 +750,22 @@ export class CommandCenter {
750750

751751
if (uri !== undefined) {
752752
// Launch desktop client if currently in web
753+
let target = `${env.uriScheme}://vscode.git/clone?url=${encodeURIComponent(uri)}`;
753754
if (env.uiKind === UIKind.Web) {
754-
let target = `${env.uriScheme}://vscode.git/clone?url=${encodeURIComponent(uri)}`;
755755
if (ref !== undefined) {
756756
target += `&ref=${encodeURIComponent(ref)}`;
757757
}
758758
return Uri.parse(target);
759759
}
760760

761-
// If already in desktop client, directly clone
761+
// If already in desktop client but in a remote window, we need to force a new window
762+
// so that the git extension can access the local filesystem for cloning
763+
if (env.remoteName !== undefined) {
764+
target += `&windowId=_blank`;
765+
return Uri.parse(target);
766+
}
767+
768+
// Otherwise, directly clone
762769
void this.clone(uri, undefined, { ref: ref });
763770
}
764771
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@parcel/watcher": "2.1.0",
7171
"@vscode/iconv-lite-umd": "0.7.0",
7272
"@vscode/policy-watcher": "^1.1.4",
73-
"@vscode/proxy-agent": "^0.14.1",
73+
"@vscode/proxy-agent": "^0.15.0",
7474
"@vscode/ripgrep": "^1.15.5",
7575
"@vscode/spdlog": "^0.13.10",
7676
"@vscode/sqlite3": "5.1.6-vscode",

remote/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@microsoft/1ds-post-js": "^3.2.2",
88
"@parcel/watcher": "2.1.0",
99
"@vscode/iconv-lite-umd": "0.7.0",
10-
"@vscode/proxy-agent": "^0.14.1",
10+
"@vscode/proxy-agent": "^0.15.0",
1111
"@vscode/ripgrep": "^1.15.5",
1212
"@vscode/spdlog": "^0.13.10",
1313
"@vscode/vscode-languagedetection": "1.0.21",

remote/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
resolved "https://registry.yarnpkg.com/@vscode/iconv-lite-umd/-/iconv-lite-umd-0.7.0.tgz#d2f1e0664ee6036408f9743fee264ea0699b0e48"
5959
integrity sha512-bRRFxLfg5dtAyl5XyiVWz/ZBPahpOpPrNYnnHpOpUZvam4tKH35wdhP4Kj6PbM0+KdliOsPzbGWpkxcdpNB/sg==
6060

61-
"@vscode/proxy-agent@^0.14.1":
62-
version "0.14.1"
63-
resolved "https://registry.yarnpkg.com/@vscode/proxy-agent/-/proxy-agent-0.14.1.tgz#61866221a8fbd5143f73a14c29deccdf85f13113"
64-
integrity sha512-bJxCO9E6zDpy90TiViAZgFjAgo83gS0Lh5CUIu/JZ8p5UwwQ37Y6LZH2f2l6kBr2RGdNSRbORTFrfmLtr1faRA==
61+
"@vscode/proxy-agent@^0.15.0":
62+
version "0.15.0"
63+
resolved "https://registry.yarnpkg.com/@vscode/proxy-agent/-/proxy-agent-0.15.0.tgz#b8fb8b89180a71295a8f8682775f69ab1dcf6860"
64+
integrity sha512-HpD4A9CUOwKbC6vLa0+MEsCo/qlgbue9U9s8Z7NzJDdf2YEGjUaYf9Mvj5T1LhJX20Hv1COvkGcc7zPhtIbgbA==
6565
dependencies:
6666
"@tootallnate/once" "^1.1.2"
6767
agent-base "^6.0.2"

src/vs/editor/browser/widget/diffEditorWidget2/diffEditorDecorations.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Disposable } from 'vs/base/common/lifecycle';
77
import { IObservable, derived } from 'vs/base/common/observable';
88
import { isDefined } from 'vs/base/common/types';
9-
import { arrowRevertChange, diffAddDecoration, diffAddDecorationEmpty, diffDeleteDecoration, diffDeleteDecorationEmpty, diffLineAddDecorationBackground, diffLineAddDecorationBackgroundWithIndicator, diffLineDeleteDecorationBackground, diffLineDeleteDecorationBackgroundWithIndicator } from 'vs/editor/browser/widget/diffEditorWidget2/decorations';
9+
import { arrowRevertChange, diffAddDecoration, diffAddDecorationEmpty, diffDeleteDecoration, diffDeleteDecorationEmpty, diffLineAddDecorationBackground, diffLineAddDecorationBackgroundWithIndicator, diffLineDeleteDecorationBackground, diffLineDeleteDecorationBackgroundWithIndicator, diffWholeLineAddDecoration, diffWholeLineDeleteDecoration } from 'vs/editor/browser/widget/diffEditorWidget2/decorations';
1010
import { DiffEditorEditors } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorEditors';
1111
import { DiffEditorOptions } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorOptions';
1212
import { DiffEditorViewModel } from 'vs/editor/browser/widget/diffEditorWidget2/diffEditorViewModel';
@@ -54,19 +54,28 @@ export class DiffEditorDecorations extends Disposable {
5454
modifiedDecorations.push({ range, options: renderIndicators ? diffLineAddDecorationBackgroundWithIndicator : diffLineAddDecorationBackground });
5555
}
5656

57-
for (const i of m.lineRangeMapping.innerChanges || []) {
58-
if (currentMove
59-
&& (currentMove.lineRangeMapping.originalRange.intersect(new LineRange(i.originalRange.startLineNumber, i.originalRange.endLineNumber))
60-
|| currentMove.lineRangeMapping.modifiedRange.intersect(new LineRange(i.modifiedRange.startLineNumber, i.modifiedRange.endLineNumber)))) {
61-
continue;
57+
if (m.lineRangeMapping.modifiedRange.isEmpty || m.lineRangeMapping.originalRange.isEmpty) {
58+
for (const range of fullRangeOriginal) {
59+
originalDecorations.push({ range, options: diffWholeLineDeleteDecoration });
6260
}
63-
64-
// Don't show empty markers outside the line range
65-
if (m.lineRangeMapping.originalRange.contains(i.originalRange.startLineNumber)) {
66-
originalDecorations.push({ range: i.originalRange, options: (i.originalRange.isEmpty() && showEmptyDecorations) ? diffDeleteDecorationEmpty : diffDeleteDecoration });
61+
for (const range of fullRangeModified) {
62+
modifiedDecorations.push({ range, options: diffWholeLineAddDecoration });
6763
}
68-
if (m.lineRangeMapping.modifiedRange.contains(i.modifiedRange.startLineNumber)) {
69-
modifiedDecorations.push({ range: i.modifiedRange, options: (i.modifiedRange.isEmpty() && showEmptyDecorations) ? diffAddDecorationEmpty : diffAddDecoration });
64+
} else {
65+
for (const i of m.lineRangeMapping.innerChanges || []) {
66+
if (currentMove
67+
&& (currentMove.lineRangeMapping.originalRange.intersect(new LineRange(i.originalRange.startLineNumber, i.originalRange.endLineNumber))
68+
|| currentMove.lineRangeMapping.modifiedRange.intersect(new LineRange(i.modifiedRange.startLineNumber, i.modifiedRange.endLineNumber)))) {
69+
continue;
70+
}
71+
72+
// Don't show empty markers outside the line range
73+
if (m.lineRangeMapping.originalRange.contains(i.originalRange.startLineNumber)) {
74+
originalDecorations.push({ range: i.originalRange, options: (i.originalRange.isEmpty() && showEmptyDecorations) ? diffDeleteDecorationEmpty : diffDeleteDecoration });
75+
}
76+
if (m.lineRangeMapping.modifiedRange.contains(i.modifiedRange.startLineNumber)) {
77+
modifiedDecorations.push({ range: i.modifiedRange, options: (i.modifiedRange.isEmpty() && showEmptyDecorations) ? diffAddDecorationEmpty : diffAddDecoration });
78+
}
7079
}
7180
}
7281

src/vs/platform/terminal/node/ptyHostService.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,10 @@ export class PtyHostService extends Disposable implements IPtyHostService {
326326
return this._proxy.setTerminalLayoutInfo(args);
327327
}
328328
async getTerminalLayoutInfo(args: IGetTerminalLayoutInfoArgs): Promise<ITerminalsLayoutInfo | undefined> {
329-
return await this._proxy.getTerminalLayoutInfo(args);
329+
// This is optional as we want reconnect requests to go through only if the pty host exists.
330+
// Revive is handled specially as reviveTerminalProcesses is guaranteed to be called before
331+
// the request for layout info.
332+
return this._optionalProxy?.getTerminalLayoutInfo(args);
330333
}
331334

332335
async requestDetachInstance(workspaceId: string, instanceId: number): Promise<IProcessDetails | undefined> {

src/vs/platform/terminal/node/ptyService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,9 @@ export class PtyService extends Disposable implements IPtyService {
552552
};
553553
} catch (e) {
554554
this._logService.warn(`Couldn't get layout info, a terminal was probably disconnected`, e.message);
555-
this._logService.info('Reattach to wrong terminal debug info - layout info by id', t);
556-
this._logService.info('Reattach to wrong terminal debug info - _revivePtyIdMap', Array.from(this._revivedPtyIdMap.values()));
555+
this._logService.debug('Reattach to wrong terminal debug info - layout info by id', t);
556+
this._logService.debug('Reattach to wrong terminal debug info - _revivePtyIdMap', Array.from(this._revivedPtyIdMap.values()));
557+
this._logService.debug('Reattach to wrong terminal debug info - _ptys ids', Array.from(this._ptys.keys()));
557558
// this will be filtered out and not reconnected
558559
return {
559560
terminal: null,

src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -337,29 +337,27 @@ class RemoteTerminalBackend extends BaseTerminalBackend implements ITerminalBack
337337

338338
// Revive processes if needed
339339
const serializedState = this._storageService.get(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
340-
const parsed = this._deserializeTerminalState(serializedState);
341-
if (!parsed) {
342-
return undefined;
343-
}
344-
345-
try {
346-
// Note that remote terminals do not get their environment re-resolved unlike in local terminals
347-
348-
mark('code/terminal/willReviveTerminalProcessesRemote');
349-
await this._remoteTerminalChannel.reviveTerminalProcesses(parsed, Intl.DateTimeFormat().resolvedOptions().locale);
350-
mark('code/terminal/didReviveTerminalProcessesRemote');
351-
this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
352-
// If reviving processes, send the terminal layout info back to the pty host as it
353-
// will not have been persisted on application exit
354-
const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
355-
if (layoutInfo) {
356-
mark('code/terminal/willSetTerminalLayoutInfoRemote');
357-
await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(layoutInfo));
358-
mark('code/terminal/didSetTerminalLayoutInfoRemote');
359-
this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
340+
const reviveBufferState = this._deserializeTerminalState(serializedState);
341+
if (reviveBufferState && reviveBufferState.length > 0) {
342+
try {
343+
// Note that remote terminals do not get their environment re-resolved unlike in local terminals
344+
345+
mark('code/terminal/willReviveTerminalProcessesRemote');
346+
await this._remoteTerminalChannel.reviveTerminalProcesses(reviveBufferState, Intl.DateTimeFormat().resolvedOptions().locale);
347+
mark('code/terminal/didReviveTerminalProcessesRemote');
348+
this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
349+
// If reviving processes, send the terminal layout info back to the pty host as it
350+
// will not have been persisted on application exit
351+
const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
352+
if (layoutInfo) {
353+
mark('code/terminal/willSetTerminalLayoutInfoRemote');
354+
await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(layoutInfo));
355+
mark('code/terminal/didSetTerminalLayoutInfoRemote');
356+
this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
357+
}
358+
} catch (e: unknown) {
359+
this._logService.warn('RemoteTerminalBackend#getTerminalLayoutInfo Error', e && typeof e === 'object' && 'message' in e ? e.message : e);
360360
}
361-
} catch (e: unknown) {
362-
this._logService.warn('RemoteTerminalBackend#getTerminalLayoutInfo Error', e && typeof e === 'object' && 'message' in e ? e.message : e);
363361
}
364362

365363
return this._remoteTerminalChannel.getTerminalLayoutInfo();

src/vs/workbench/contrib/terminal/electron-sandbox/localTerminalBackend.ts

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -317,43 +317,41 @@ class LocalTerminalBackend extends BaseTerminalBackend implements ITerminalBacke
317317

318318
// Revive processes if needed
319319
const serializedState = this._storageService.get(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
320-
const parsed = this._deserializeTerminalState(serializedState);
321-
if (!parsed) {
322-
return undefined;
323-
}
324-
325-
try {
326-
// Create variable resolver
327-
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot();
328-
const lastActiveWorkspace = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
329-
const variableResolver = terminalEnvironment.createVariableResolver(lastActiveWorkspace, await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority), this._configurationResolverService);
330-
331-
// Re-resolve the environments and replace it on the state so local terminals use a fresh
332-
// environment
333-
mark('code/terminal/willGetReviveEnvironments');
334-
await Promise.all(parsed.map(state => new Promise<void>(r => {
335-
this._resolveEnvironmentForRevive(variableResolver, state.shellLaunchConfig).then(freshEnv => {
336-
state.processLaunchConfig.env = freshEnv;
337-
r();
338-
});
339-
})));
340-
mark('code/terminal/didGetReviveEnvironments');
341-
342-
mark('code/terminal/willReviveTerminalProcesses');
343-
await this._proxy.reviveTerminalProcesses(workspaceId, parsed, Intl.DateTimeFormat().resolvedOptions().locale);
344-
mark('code/terminal/didReviveTerminalProcesses');
345-
this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
346-
// If reviving processes, send the terminal layout info back to the pty host as it
347-
// will not have been persisted on application exit
348-
const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
349-
if (layoutInfo) {
350-
mark('code/terminal/willSetTerminalLayoutInfo');
351-
await this._proxy.setTerminalLayoutInfo(JSON.parse(layoutInfo));
352-
mark('code/terminal/didSetTerminalLayoutInfo');
353-
this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
320+
const reviveBufferState = this._deserializeTerminalState(serializedState);
321+
if (reviveBufferState && reviveBufferState.length > 0) {
322+
try {
323+
// Create variable resolver
324+
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot();
325+
const lastActiveWorkspace = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
326+
const variableResolver = terminalEnvironment.createVariableResolver(lastActiveWorkspace, await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority), this._configurationResolverService);
327+
328+
// Re-resolve the environments and replace it on the state so local terminals use a fresh
329+
// environment
330+
mark('code/terminal/willGetReviveEnvironments');
331+
await Promise.all(reviveBufferState.map(state => new Promise<void>(r => {
332+
this._resolveEnvironmentForRevive(variableResolver, state.shellLaunchConfig).then(freshEnv => {
333+
state.processLaunchConfig.env = freshEnv;
334+
r();
335+
});
336+
})));
337+
mark('code/terminal/didGetReviveEnvironments');
338+
339+
mark('code/terminal/willReviveTerminalProcesses');
340+
await this._proxy.reviveTerminalProcesses(workspaceId, reviveBufferState, Intl.DateTimeFormat().resolvedOptions().locale);
341+
mark('code/terminal/didReviveTerminalProcesses');
342+
this._storageService.remove(TerminalStorageKeys.TerminalBufferState, StorageScope.WORKSPACE);
343+
// If reviving processes, send the terminal layout info back to the pty host as it
344+
// will not have been persisted on application exit
345+
const layoutInfo = this._storageService.get(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
346+
if (layoutInfo) {
347+
mark('code/terminal/willSetTerminalLayoutInfo');
348+
await this._proxy.setTerminalLayoutInfo(JSON.parse(layoutInfo));
349+
mark('code/terminal/didSetTerminalLayoutInfo');
350+
this._storageService.remove(TerminalStorageKeys.TerminalLayoutInfo, StorageScope.WORKSPACE);
351+
}
352+
} catch (e: unknown) {
353+
this._logService.warn('LocalTerminalBackend#getTerminalLayoutInfo Error', e && typeof e === 'object' && 'message' in e ? e.message : e);
354354
}
355-
} catch (e: unknown) {
356-
this._logService.warn('LocalTerminalBackend#getTerminalLayoutInfo Error', e && typeof e === 'object' && 'message' in e ? e.message : e);
357355
}
358356

359357
return this._proxy.getTerminalLayoutInfo(layoutArgs);

src/vs/workbench/services/textMate/browser/worker/textMateWorkerModel.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6+
import { importAMDNodeModule } from 'vs/amdX';
67
import { RunOnceScheduler } from 'vs/base/common/async';
78
import { observableValue } from 'vs/base/common/observable';
9+
import { setTimeout0 } from 'vs/base/common/platform';
810
import { URI } from 'vs/base/common/uri';
911
import { LineRange } from 'vs/editor/common/core/lineRange';
1012
import { LanguageId } from 'vs/editor/common/encodedTokenAttributes';
1113
import { IModelChangedEvent, MirrorTextModel } from 'vs/editor/common/model/mirrorTextModel';
1214
import { TokenizerWithStateStore } from 'vs/editor/common/model/textModelTokens';
13-
import type { diffStateStacksRefEq, StateStack, StackDiff } from 'vscode-textmate';
1415
import { ContiguousMultilineTokensBuilder } from 'vs/editor/common/tokens/contiguousMultilineTokensBuilder';
1516
import { LineTokens } from 'vs/editor/common/tokens/lineTokens';
1617
import { TextMateTokenizationSupport } from 'vs/workbench/services/textMate/browser/tokenizationSupport/textMateTokenizationSupport';
1718
import { TokenizationSupportWithLineLimit } from 'vs/workbench/services/textMate/browser/tokenizationSupport/tokenizationSupportWithLineLimit';
1819
import { StateDeltas } from 'vs/workbench/services/textMate/browser/workerHost/textMateWorkerHost';
20+
import type { StackDiff, StateStack, diffStateStacksRefEq } from 'vscode-textmate';
1921
import { TextMateTokenizationWorker } from './textMate.worker';
20-
import { importAMDNodeModule } from 'vs/amdX';
2122

2223
export class TextMateWorkerModel extends MirrorTextModel {
2324
private _tokenizationStateStore: TokenizerWithStateStore<StateStack> | null = null;
@@ -169,7 +170,7 @@ export class TextMateWorkerModel extends MirrorTextModel {
169170
const deltaMs = new Date().getTime() - startTime;
170171
if (deltaMs > 20) {
171172
// yield to check for changes
172-
setTimeout(() => this._tokenize(), 3);
173+
setTimeout0(() => this._tokenize());
173174
return;
174175
}
175176
}

0 commit comments

Comments
 (0)