Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreadman committed Nov 18, 2024
2 parents 3e0fb94 + 9dcdbb8 commit 275f315
Show file tree
Hide file tree
Showing 62 changed files with 1,184 additions and 543 deletions.
2 changes: 1 addition & 1 deletion build/win32/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/win32/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "inno_updater"
version = "0.11.1"
version = "0.12.0"
authors = ["Microsoft <[email protected]>"]
build = "build.rs"

Expand Down
Binary file modified build/win32/inno_updater.exe
Binary file not shown.
5 changes: 4 additions & 1 deletion extensions/csharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
{
"language": "csharp",
"scopeName": "source.cs",
"path": "./syntaxes/csharp.tmLanguage.json"
"path": "./syntaxes/csharp.tmLanguage.json",
"tokenTypes": {
"meta.interpolation": "other"
}
}
],
"snippets": [
Expand Down
22 changes: 19 additions & 3 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"scmValidation",
"tabInputMultiDiff",
"tabInputTextMerge",
"textEditorDiffInformation",
"timeline"
],
"categories": [
Expand Down Expand Up @@ -567,7 +568,7 @@
"title": "%command.pull%",
"icon": "$(repo-pull)",
"category": "Git",
"enablement": "!operationInProgress"
"enablement": "!operationInProgress && scmCurrentHistoryItemRefInFilter && scmCurrentHistoryItemRefHasRemote"
},
{
"command": "git.push",
Expand Down Expand Up @@ -616,7 +617,7 @@
"title": "%command.push%",
"icon": "$(repo-push)",
"category": "Git",
"enablement": "!operationInProgress"
"enablement": "!operationInProgress && scmCurrentHistoryItemRefInFilter && scmCurrentHistoryItemRefHasRemote"
},
{
"command": "git.cherryPick",
Expand Down Expand Up @@ -1968,8 +1969,23 @@
"scm/history/title": [
{
"command": "git.fetchAll",
"group": "navigation@999",
"group": "navigation@900",
"when": "scmProvider == git"
},
{
"command": "git.pullRef",
"group": "navigation@901",
"when": "scmProvider == git"
},
{
"command": "git.pushRef",
"when": "scmProvider == git && scmCurrentHistoryItemRefHasRemote",
"group": "navigation@902"
},
{
"command": "git.publish",
"when": "scmProvider == git && !scmCurrentHistoryItemRefHasRemote",
"group": "navigation@903"
}
],
"scm/historyItem/context": [
Expand Down
1 change: 1 addition & 0 deletions extensions/git/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"../../src/vscode-dts/vscode.proposed.scmTextDocument.d.ts",
"../../src/vscode-dts/vscode.proposed.tabInputMultiDiff.d.ts",
"../../src/vscode-dts/vscode.proposed.tabInputTextMerge.d.ts",
"../../src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts",
"../../src/vscode-dts/vscode.proposed.timeline.d.ts",
"../../src/vscode-dts/vscode.proposed.quickInputButtonLocation.d.ts",
"../types/lib.textEncoder.d.ts"
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/browser/cssValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export function asCSSUrl(uri: URI | null | undefined): CssFragment {
return inline`url(${stringValue(FileAccess.uriToBrowserUri(uri).toString(true))})`;
}

export function className(value: string): CssFragment {
export function className(value: string, escapingExcected = false): CssFragment {
const out = CSS.escape(value);
if (out !== value) {
if (!escapingExcected && out !== value) {
console.warn(`CSS class name ${value} modified to ${out} to be safe for CSS`);
}
return asFragment(out);
Expand Down
19 changes: 15 additions & 4 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,14 @@ export class CodeApplication extends Disposable {

// Set lifecycle phase to `Eventually` after a short delay and when idle (min 2.5sec, max 5sec)
const eventuallyPhaseScheduler = this._register(new RunOnceScheduler(() => {
this._register(runWhenGlobalIdle(() => this.lifecycleMainService.phase = LifecycleMainPhase.Eventually, 2500));
this._register(runWhenGlobalIdle(() => {

// Signal phase: eventually
this.lifecycleMainService.phase = LifecycleMainPhase.Eventually;

// Eventually Post Open Window Tasks
this.eventuallyAfterWindowOpen();
}, 2500));
}, 2500));
eventuallyPhaseScheduler.schedule();
}
Expand Down Expand Up @@ -1373,9 +1380,6 @@ export class CodeApplication extends Disposable {
if (isMacintosh && app.runningUnderARM64Translation) {
this.windowsMainService?.sendToFocused('vscode:showTranslatedBuildWarning');
}

// Validate Device ID is up to date
validatedevDeviceId(this.stateService, this.logService);
}

private async installMutex(): Promise<void> {
Expand Down Expand Up @@ -1451,4 +1455,11 @@ export class CodeApplication extends Disposable {
this.windowsMainService?.sendToFocused('vscode:showArgvParseWarning');
}
}

private eventuallyAfterWindowOpen(): void {

// Validate Device ID is up to date (delay this as it has shown significant perf impact)
// Refs: https://github.com/microsoft/vscode/issues/234064
validatedevDeviceId(this.stateService, this.logService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export class DefaultExtensionsInitializer extends Disposable {

private getDefaultExtensionVSIXsLocation(): URI {
// appRoot = C:\Users\<name>\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app
// extensionsPath = C:\Users\<name>\AppData\Local\Programs\Microsoft VS Code Insiders\extras\extensions
return URI.file(join(dirname(dirname(this.environmentService.appRoot)), 'extras', 'extensions'));
// extensionsPath = C:\Users\<name>\AppData\Local\Programs\Microsoft VS Code Insiders\bootstrap\extensions
return URI.file(join(dirname(dirname(this.environmentService.appRoot)), 'bootstrap', 'extensions'));
}

}
93 changes: 59 additions & 34 deletions src/vs/editor/browser/gpu/fullFileRenderStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EditorOption } from '../../common/config/editorOptions.js';
import { CursorColumns } from '../../common/core/cursorColumns.js';
import type { IViewLineTokens } from '../../common/tokens/lineTokens.js';
import { ViewEventHandler } from '../../common/viewEventHandler.js';
import type { ViewConfigurationChangedEvent, ViewLinesChangedEvent, ViewLinesDeletedEvent, ViewLinesInsertedEvent, ViewScrollChangedEvent, ViewTokensChangedEvent } from '../../common/viewEvents.js';
import { ViewEventType, type ViewConfigurationChangedEvent, type ViewLinesChangedEvent, type ViewLinesDeletedEvent, type ViewLinesInsertedEvent, type ViewScrollChangedEvent, type ViewTokensChangedEvent, type ViewZonesChangedEvent } from '../../common/viewEvents.js';
import type { ViewportData } from '../../common/viewLayout/viewLinesViewportData.js';
import type { ViewLineRenderingData } from '../../common/viewModel.js';
import type { ViewContext } from '../../common/viewModel/viewContext.js';
Expand Down Expand Up @@ -38,6 +38,8 @@ const enum CellBufferInfo {
TextureIndex = 5,
}

type QueuedBufferEvent = ViewLinesDeletedEvent | ViewZonesChangedEvent;

export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRenderStrategy {

readonly wgsl: string = fullFileRenderStrategyWgsl;
Expand All @@ -61,7 +63,7 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
private _scrollOffsetValueBuffer: Float32Array;
private _scrollInitialized: boolean = false;

private readonly _queuedBufferUpdates: [ViewLinesDeletedEvent[], ViewLinesDeletedEvent[]] = [[], []];
private readonly _queuedBufferUpdates: [QueuedBufferEvent[], QueuedBufferEvent[]] = [[], []];

get bindGroupEntries(): GPUBindGroupEntry[] {
return [
Expand Down Expand Up @@ -129,15 +131,7 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
// TODO: This currently invalidates everything after the deleted line, it could shift the
// line data up to retain some up to date lines
// TODO: This does not invalidate lines that are no longer in the file
for (const i of [0, 1]) {
const upToDateLines = this._upToDateLines[i];
const lines = Array.from(upToDateLines);
for (const upToDateLine of lines) {
if (upToDateLine > e.fromLineNumber) {
upToDateLines.delete(upToDateLine);
}
}
}
this._invalidateLinesFrom(e.fromLineNumber);

// Queue updates that need to happen on the active buffer, not just the cache. This is
// deferred since the active buffer could be locked by the GPU which would block the main
Expand All @@ -150,15 +144,7 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
public override onLinesInserted(e: ViewLinesInsertedEvent): boolean {
// TODO: This currently invalidates everything after the deleted line, it could shift the
// line data up to retain some up to date lines
for (const i of [0, 1]) {
const upToDateLines = this._upToDateLines[i];
const lines = Array.from(upToDateLines);
for (const upToDateLine of lines) {
if (upToDateLine > e.fromLineNumber) {
upToDateLines.delete(upToDateLine);
}
}
}
this._invalidateLinesFrom(e.fromLineNumber);
return true;
}

Expand All @@ -178,8 +164,32 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
return true;
}

public override onZonesChanged(e: ViewZonesChangedEvent): boolean {
this._upToDateLines[0].clear();
this._upToDateLines[1].clear();

// Queue updates that need to happen on the active buffer, not just the cache. This is
// deferred since the active buffer could be locked by the GPU which would block the main
// thread.
this._queueBufferUpdate(e);

return true;
}

// #endregion

private _invalidateLinesFrom(lineNumber: number): void {
for (const i of [0, 1]) {
const upToDateLines = this._upToDateLines[i];
const lines = Array.from(upToDateLines);
for (const upToDateLine of lines) {
if (upToDateLine >= lineNumber) {
upToDateLines.delete(upToDateLine);
}
}
}
}

reset() {
for (const bufferIndex of [0, 1]) {
// Zero out buffer and upload to GPU to prevent stale rows from rendering
Expand Down Expand Up @@ -234,19 +244,34 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
while (queuedBufferUpdates.length) {
const e = queuedBufferUpdates.shift()!;

// Shift content below deleted line up
const deletedLineContentStartIndex = (e.fromLineNumber - 1) * this._viewGpuContext.maxGpuCols * Constants.IndicesPerCell;
const deletedLineContentEndIndex = (e.toLineNumber) * this._viewGpuContext.maxGpuCols * Constants.IndicesPerCell;
const nullContentStartIndex = (this._finalRenderedLine - (e.toLineNumber - e.fromLineNumber + 1)) * this._viewGpuContext.maxGpuCols * Constants.IndicesPerCell;
cellBuffer.set(cellBuffer.subarray(deletedLineContentEndIndex), deletedLineContentStartIndex);

// Zero out content on lines that are no longer valid
cellBuffer.fill(0, nullContentStartIndex);

// Update dirty lines and final rendered line
dirtyLineStart = Math.min(dirtyLineStart, e.fromLineNumber);
dirtyLineEnd = this._finalRenderedLine;
this._finalRenderedLine -= e.toLineNumber - e.fromLineNumber + 1;
switch (e.type) {
case ViewEventType.ViewLinesDeleted: {
// Shift content below deleted line up
const deletedLineContentStartIndex = (e.fromLineNumber - 1) * this._viewGpuContext.maxGpuCols * Constants.IndicesPerCell;
const deletedLineContentEndIndex = (e.toLineNumber) * this._viewGpuContext.maxGpuCols * Constants.IndicesPerCell;
const nullContentStartIndex = (this._finalRenderedLine - (e.toLineNumber - e.fromLineNumber + 1)) * this._viewGpuContext.maxGpuCols * Constants.IndicesPerCell;
cellBuffer.set(cellBuffer.subarray(deletedLineContentEndIndex), deletedLineContentStartIndex);

// Zero out content on lines that are no longer valid
cellBuffer.fill(0, nullContentStartIndex);

// Update dirty lines and final rendered line
dirtyLineStart = Math.min(dirtyLineStart, e.fromLineNumber);
dirtyLineEnd = this._finalRenderedLine;
this._finalRenderedLine -= e.toLineNumber - e.fromLineNumber + 1;
break;
}
case ViewEventType.ViewZonesChanged: {
// TODO: We could retain render data if we know what view zones changed and how
// Zero out content on all lines
cellBuffer.fill(0);

dirtyLineStart = 1;
dirtyLineEnd = this._finalRenderedLine;
this._finalRenderedLine = 0;
break;
}
}
}

for (y = viewportData.startLineNumber; y <= viewportData.endLineNumber; y++) {
Expand Down Expand Up @@ -364,7 +389,7 @@ export class FullFileRenderStrategy extends ViewEventHandler implements IGpuRend
);
}

private _queueBufferUpdate(e: ViewLinesDeletedEvent) {
private _queueBufferUpdate(e: QueuedBufferEvent) {
this._queuedBufferUpdates[0].push(e);
this._queuedBufferUpdates[1].push(e);
}
Expand Down
11 changes: 11 additions & 0 deletions src/vs/editor/browser/gpu/viewGpuContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { GPULifecycle } from './gpuDisposable.js';
import { ensureNonNullable, observeDevicePixelDimensions } from './gpuUtils.js';
import { RectangleRenderer } from './rectangleRenderer.js';
import type { ViewContext } from '../../common/viewModel/viewContext.js';
import { Event } from '../../../base/common/event.js';
import type { IEditorOptions } from '../../common/config/editorOptions.js';

const enum GpuRenderLimits {
maxGpuLines = 3000,
Expand Down Expand Up @@ -83,6 +85,15 @@ export class ViewGpuContext extends Disposable {
this.canvas = createFastDomNode(document.createElement('canvas'));
this.canvas.setClassName('editorCanvas');

// Adjust the canvas size to avoid drawing under the scroll bar
this._register(Event.runAndSubscribe(configurationService.onDidChangeConfiguration, e => {
if (!e || e.affectsConfiguration('editor.scrollbar.verticalScrollbarSize')) {
const verticalScrollbarSize = configurationService.getValue<IEditorOptions>('editor').scrollbar?.verticalScrollbarSize ?? 14;
this.canvas.domNode.style.boxSizing = 'border-box';
this.canvas.domNode.style.paddingRight = `${verticalScrollbarSize}px`;
}
}));

this.ctx = ensureNonNullable(this.canvas.domNode.getContext('webgpu'));

this.device = GPULifecycle.requestDevice((message) => {
Expand Down
4 changes: 4 additions & 0 deletions src/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ export class ViewLinesGpu extends ViewPart implements IViewLines {
pass.setPipeline(this._pipeline);
pass.setVertexBuffer(0, this._vertexBuffer);

// Only draw the content area
const contentLeft = Math.ceil(this._contentLeftObs.get() * this._viewGpuContext.devicePixelRatio.get());
pass.setScissorRect(contentLeft, 0, this.canvas.width - contentLeft, this.canvas.height);

pass.setBindGroup(0, this._bindGroup);

if (this._renderStrategy?.draw) {
Expand Down
28 changes: 28 additions & 0 deletions src/vs/platform/editor/common/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { equals } from '../../../base/common/arrays.js';
import { IDisposable } from '../../../base/common/lifecycle.js';
import { URI } from '../../../base/common/uri.js';
import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';

export interface IResolvableEditorModel extends IDisposable {

Expand Down Expand Up @@ -376,3 +378,29 @@ export interface ITextEditorOptions extends IEditorOptions {
*/
selectionSource?: TextEditorSelectionSource | string;
}

export type ITextEditorDiff = [
originalStartLineNumber: number,
originalEndLineNumber: number,
modifiedStartLineNumber: number,
modifiedEndLineNumber: number
];

export interface ITextEditorDiffInformation {
readonly documentVersion: number;
readonly original: URI | undefined;
readonly modified: URI;
readonly diff: readonly ITextEditorDiff[];
}

export function isTextEditorDiffInformationEqual(
uriIdentityService: IUriIdentityService,
diff1: ITextEditorDiffInformation | undefined,
diff2: ITextEditorDiffInformation | undefined): boolean {
return diff1?.documentVersion === diff2?.documentVersion &&
uriIdentityService.extUri.isEqual(diff1?.original, diff2?.original) &&
uriIdentityService.extUri.isEqual(diff1?.modified, diff2?.modified) &&
equals<ITextEditorDiff>(diff1?.diff, diff2?.diff, (a, b) => {
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
});
}
3 changes: 3 additions & 0 deletions src/vs/platform/extensions/common/extensionsApiProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ const _allApiProposals = {
testRelatedCode: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testRelatedCode.d.ts',
},
textEditorDiffInformation: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDiffInformation.d.ts',
},
textSearchComplete2: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchComplete2.d.ts',
},
Expand Down
Loading

0 comments on commit 275f315

Please sign in to comment.