Skip to content

Commit 2ad06b1

Browse files
authored
Merge branch 'main' into aamunger/fileBackedIW
2 parents 82d4b71 + 7288d30 commit 2ad06b1

File tree

28 files changed

+361
-689
lines changed

28 files changed

+361
-689
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,16 @@ async function preload(logger: Logger): Promise<void> {
109109

110110
const workspaceUri = vscode.workspace.workspaceFolders?.[0].uri;
111111
if (!workspaceUri || workspaceUri.scheme !== 'vscode-vfs' || workspaceUri.authority !== 'github') {
112-
return undefined;
112+
logger.info(`Skipped loading workspace contents for repository ${workspaceUri?.toString()}`);
113+
return;
113114
}
114115

115116
try {
116117
const remoteHubApi = await RemoteRepositories.getApi();
117-
if (remoteHubApi.loadWorkspaceContents !== undefined) {
118-
if (await remoteHubApi.loadWorkspaceContents(workspaceUri)) {
119-
logger.info(`Successfully loaded workspace content for repository ${workspaceUri.toString()}`);
120-
} else {
121-
logger.info(`Failed to load workspace content for repository ${workspaceUri.toString()}`);
122-
}
123-
118+
if (await remoteHubApi.loadWorkspaceContents?.(workspaceUri)) {
119+
logger.info(`Successfully loaded workspace content for repository ${workspaceUri.toString()}`);
120+
} else {
121+
logger.info(`Failed to load workspace content for repository ${workspaceUri.toString()}`);
124122
}
125123
} catch (error) {
126124
logger.info(`Loading workspace content for repository ${workspaceUri.toString()} failed: ${error instanceof Error ? error.toString() : 'Unknown reason'}`);

src/vs/code/electron-main/app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,11 @@ export class CodeApplication extends Disposable {
12511251

12521252
// Crash reporter
12531253
this.updateCrashReporterEnablement();
1254+
1255+
if (app.runningUnderARM64Translation) {
1256+
this.windowsMainService?.sendToFocused('vscode:showTranslatedBuildWarning');
1257+
}
1258+
12541259
}
12551260

12561261
private async installMutex(): Promise<void> {

src/vs/editor/browser/widget/diffEditorWidget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class VisualEditorState {
143143
for (let i = 0, length = newDecorations.zones.length; i < length; i++) {
144144
const viewZone = <editorBrowser.IViewZone>newDecorations.zones[i];
145145
viewZone.suppressMouseDown = true;
146+
viewZone.showInHiddenAreas = true;
146147
const zoneId = viewChangeAccessor.addZone(viewZone);
147148
this._zones.push(zoneId);
148149
this._zonesMap[String(zoneId)] = true;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export class ViewZoneManager extends Disposable {
213213
afterLineNumber: a.originalRange.startLineNumber + i,
214214
domNode: createFakeLinesDiv(),
215215
heightInPx: (count - 1) * modLineHeight,
216+
showInHiddenAreas: true,
216217
});
217218
}
218219
}
@@ -224,6 +225,7 @@ export class ViewZoneManager extends Disposable {
224225
minWidthInPx: result.minWidthInPx,
225226
marginDomNode,
226227
setZoneId(id) { zoneId = id; },
228+
showInHiddenAreas: true,
227229
});
228230
}
229231

@@ -290,12 +292,14 @@ export class ViewZoneManager extends Disposable {
290292
afterLineNumber: a.originalRange.endLineNumberExclusive - 1,
291293
domNode: createFakeLinesDiv(),
292294
heightInPx: delta,
295+
showInHiddenAreas: true,
293296
});
294297
} else {
295298
modViewZones.push({
296299
afterLineNumber: a.modifiedRange.endLineNumberExclusive - 1,
297300
domNode: createFakeLinesDiv(),
298301
heightInPx: -delta,
302+
showInHiddenAreas: true,
299303
});
300304
}
301305
}

src/vs/editor/common/config/editorOptions.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4629,6 +4629,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, ISuggestOptio
46294629

46304630
export interface ISmartSelectOptions {
46314631
selectLeadingAndTrailingWhitespace?: boolean;
4632+
selectSubwords?: boolean;
46324633
}
46334634

46344635
/**
@@ -4642,13 +4643,19 @@ class SmartSelect extends BaseEditorOption<EditorOption.smartSelect, ISmartSelec
46424643
super(
46434644
EditorOption.smartSelect, 'smartSelect',
46444645
{
4645-
selectLeadingAndTrailingWhitespace: true
4646+
selectLeadingAndTrailingWhitespace: true,
4647+
selectSubwords: true,
46464648
},
46474649
{
46484650
'editor.smartSelect.selectLeadingAndTrailingWhitespace': {
46494651
description: nls.localize('selectLeadingAndTrailingWhitespace', "Whether leading and trailing whitespace should always be selected."),
46504652
default: true,
46514653
type: 'boolean'
4654+
},
4655+
'editor.smartSelect.selectSubwords': {
4656+
description: nls.localize('selectSubwords', "Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),
4657+
default: true,
4658+
type: 'boolean'
46524659
}
46534660
}
46544661
);
@@ -4659,7 +4666,8 @@ class SmartSelect extends BaseEditorOption<EditorOption.smartSelect, ISmartSelec
46594666
return this.defaultValue;
46604667
}
46614668
return {
4662-
selectLeadingAndTrailingWhitespace: boolean((input as ISmartSelectOptions).selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace)
4669+
selectLeadingAndTrailingWhitespace: boolean((input as ISmartSelectOptions).selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace),
4670+
selectSubwords: boolean((input as ISmartSelectOptions).selectSubwords, this.defaultValue.selectSubwords),
46634671
};
46644672
}
46654673
}

src/vs/editor/common/diff/algorithms/myersDiffAlgorithm.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,23 @@ export class MyersDiffAlgorithm implements IDiffAlgorithm {
3939

4040
loop: while (true) {
4141
d++;
42-
for (k = -d; k <= d; k += 2) {
43-
if (!timeout.isValid()) {
44-
return DiffAlgorithmResult.trivialTimedOut(seq1, seq2);
45-
}
46-
47-
const maxXofDLineTop = k === d ? -1 : V.get(k + 1); // We take a vertical non-diagonal
48-
const maxXofDLineLeft = k === -d ? -1 : V.get(k - 1) + 1; // We take a horizontal non-diagonal (+1 x)
42+
if (!timeout.isValid()) {
43+
return DiffAlgorithmResult.trivialTimedOut(seq1, seq2);
44+
}
45+
// The paper has `for (k = -d; k <= d; k += 2)`, but we can ignore diagonals that cannot influence the result.
46+
const lowerBound = -Math.min(d, seq2.length + (d % 2));
47+
const upperBound = Math.min(d, seq1.length + (d % 2));
48+
for (k = lowerBound; k <= upperBound; k += 2) {
49+
// We can use the X values of (d-1)-lines to compute X value of the longest d-lines.
50+
const maxXofDLineTop = k === upperBound ? -1 : V.get(k + 1); // We take a vertical non-diagonal (add a symbol in seq1)
51+
const maxXofDLineLeft = k === lowerBound ? -1 : V.get(k - 1) + 1; // We take a horizontal non-diagonal (+1 x) (delete a symbol in seq1)
4952
const x = Math.min(Math.max(maxXofDLineTop, maxXofDLineLeft), seq1.length);
5053
const y = x - k;
54+
if (x > seq1.length || y > seq2.length) {
55+
// This diagonal is irrelevant for the result.
56+
// TODO: Don't pay the cost for this in the next iteration.
57+
continue;
58+
}
5159
const newMaxX = getXAfterSnake(x, y);
5260
V.set(k, newMaxX);
5361
const lastPath = x === maxXofDLineTop ? paths.get(k + 1) : paths.get(k - 1);

src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,18 @@ export class CopyPasteController extends Disposable implements IEditorContributi
114114
}
115115

116116
private handleCopy(e: ClipboardEvent) {
117-
if (!e.clipboardData || !this._editor.hasTextFocus() || !this.isPasteAsEnabled()) {
117+
if (!this._editor.hasTextFocus()) {
118+
return;
119+
}
120+
121+
if (platform.isWeb) {
122+
// Explicitly clear the web resources clipboard.
123+
// This is needed because on web, the browser clipboard is faked out using an in-memory store.
124+
// This means the resources clipboard is not properly updated when copying from the editor.
125+
this._clipboardService.writeResources([]);
126+
}
127+
128+
if (!e.clipboardData || !this.isPasteAsEnabled()) {
118129
return;
119130
}
120131

src/vs/editor/contrib/smartSelect/browser/smartSelect.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,13 @@ registerEditorAction(ShrinkSelectionAction);
208208

209209
export interface SelectionRangesOptions {
210210
selectLeadingAndTrailingWhitespace: boolean;
211+
selectSubwords: boolean;
211212
}
212213

213214
export async function provideSelectionRanges(registry: LanguageFeatureRegistry<languages.SelectionRangeProvider>, model: ITextModel, positions: Position[], options: SelectionRangesOptions, token: CancellationToken): Promise<Range[][]> {
214215

215216
const providers = registry.all(model)
216-
.concat(new WordSelectionRangeProvider()); // ALWAYS have word based selection range
217+
.concat(new WordSelectionRangeProvider(options.selectSubwords)); // ALWAYS have word based selection range
217218

218219
if (providers.length === 1) {
219220
// add word selection and bracket selection when no provider exists
@@ -313,7 +314,7 @@ CommandsRegistry.registerCommand('_executeSelectionRangeProvider', async functio
313314
const reference = await accessor.get(ITextModelService).createModelReference(resource);
314315

315316
try {
316-
return provideSelectionRanges(registry, reference.object.textEditorModel, positions, { selectLeadingAndTrailingWhitespace: true }, CancellationToken.None);
317+
return provideSelectionRanges(registry, reference.object.textEditorModel, positions, { selectLeadingAndTrailingWhitespace: true, selectSubwords: true }, CancellationToken.None);
317318
} finally {
318319
reference.dispose();
319320
}

src/vs/editor/contrib/smartSelect/browser/wordSelections.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ import { SelectionRange, SelectionRangeProvider } from 'vs/editor/common/languag
1212

1313
export class WordSelectionRangeProvider implements SelectionRangeProvider {
1414

15+
constructor(private readonly selectSubwords = true) { }
16+
1517
provideSelectionRanges(model: ITextModel, positions: Position[]): SelectionRange[][] {
1618
const result: SelectionRange[][] = [];
1719
for (const position of positions) {
1820
const bucket: SelectionRange[] = [];
1921
result.push(bucket);
20-
this._addInWordRanges(bucket, model, position);
22+
if (this.selectSubwords) {
23+
this._addInWordRanges(bucket, model, position);
24+
}
2125
this._addWordRanges(bucket, model, position);
2226
this._addWhitespaceLine(bucket, model, position);
2327
bucket.push({ range: model.getFullModelRange() });

src/vs/editor/contrib/smartSelect/test/browser/smartSelect.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ suite('SmartSelect', () => {
6767
async function assertGetRangesToPosition(text: string[], lineNumber: number, column: number, ranges: Range[], selectLeadingAndTrailingWhitespace = true): Promise<void> {
6868
const uri = URI.file('test.js');
6969
const model = modelService.createModel(text.join('\n'), new StaticLanguageSelector(languageId), uri);
70-
const [actual] = await provideSelectionRanges(providers, model, [new Position(lineNumber, column)], { selectLeadingAndTrailingWhitespace }, CancellationToken.None);
70+
const [actual] = await provideSelectionRanges(providers, model, [new Position(lineNumber, column)], { selectLeadingAndTrailingWhitespace, selectSubwords: true }, CancellationToken.None);
7171
const actualStr = actual!.map(r => new Range(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn).toString());
7272
const desiredStr = ranges.reverse().map(r => String(r));
7373

@@ -294,6 +294,24 @@ suite('SmartSelect', () => {
294294
);
295295
});
296296

297+
test('in-word ranges with selectSubwords=false', async () => {
298+
299+
await assertRanges(new WordSelectionRangeProvider(false), 'f|ooBar',
300+
new Range(1, 1, 1, 7),
301+
new Range(1, 1, 1, 7),
302+
);
303+
304+
await assertRanges(new WordSelectionRangeProvider(false), 'f|oo_Ba',
305+
new Range(1, 1, 1, 7),
306+
new Range(1, 1, 1, 7),
307+
);
308+
309+
await assertRanges(new WordSelectionRangeProvider(false), 'f|oo-Ba',
310+
new Range(1, 1, 1, 7),
311+
new Range(1, 1, 1, 7),
312+
);
313+
});
314+
297315
test('Default selection should select current word/hump first in camelCase #67493', async function () {
298316

299317
await assertRanges(new WordSelectionRangeProvider(), 'Abs|tractSmartSelect',

0 commit comments

Comments
 (0)