Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/vs/editor/browser/viewParts/lines/viewLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import { StringBuilder } from 'vs/editor/common/core/stringBuilder';
import { IEditorConfiguration } from 'vs/editor/common/config/editorConfiguration';
import { FloatHorizontalRange, VisibleRanges } from 'vs/editor/browser/view/renderingContext';
import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
import { CharacterMapping, ForeignElementType, RenderLineInput, renderViewLine, LineRange, DomPosition } from 'vs/editor/common/viewLayout/viewLineRenderer';
import { CharacterMapping, ForeignElementType, RenderLineInput, renderViewLine, LineRange, DomPosition, resolveRenderLineInput } from 'vs/editor/common/viewLayout/viewLineRenderer';
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
import { InlineDecorationType } from 'vs/editor/common/viewModel';
import { ColorScheme, isHighContrast } from 'vs/platform/theme/common/theme';
import { EditorOption, EditorFontLigatures } from 'vs/editor/common/config/editorOptions';
import { DomReadingContext } from 'vs/editor/browser/viewParts/lines/domReadingContext';
import { CommandService } from 'vs/workbench/services/commands/common/commandService';

const canUseFastRenderedViewLine = (function () {
if (platform.isNative) {
Expand Down Expand Up @@ -227,6 +228,9 @@ export class ViewLine implements IVisibleLine {
sb.appendString(ViewLine.CLASS_NAME);
sb.appendString('">');

// MEMBRANE: Use MessagePort
CommandService.getInstance().executeCommand('membrane.textEditor.onLineChanged', lineNumber, deltaTop, resolveRenderLineInput(renderLineInput));

const output = renderViewLine(renderLineInput, sb);

sb.appendString('</div>');
Expand Down Expand Up @@ -259,6 +263,8 @@ export class ViewLine implements IVisibleLine {
if (this._renderedViewLine && this._renderedViewLine.domNode) {
this._renderedViewLine.domNode.setTop(deltaTop);
this._renderedViewLine.domNode.setHeight(this._options.lineHeight);
// MEMBRANE: Use MessagePort
CommandService.getInstance().executeCommand('membrane.textEditor.onLineMoved', lineNumber, deltaTop);
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/vs/editor/browser/viewParts/lines/viewLines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import * as viewEvents from 'vs/editor/common/viewEvents';
import { ViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
import { Viewport } from 'vs/editor/common/viewModel';
import { ViewContext } from 'vs/editor/common/viewModel/viewContext';
import { CommandService } from 'vs/workbench/services/commands/common/commandService';

class LastRenderedData {

Expand Down Expand Up @@ -261,9 +262,11 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
return this._visibleLines.onLinesChanged(e);
}
public override onLinesDeleted(e: viewEvents.ViewLinesDeletedEvent): boolean {
CommandService.getInstance().executeCommand('membrane.textEditor.onLinesDeleted', e.fromLineNumber, e.toLineNumber - e.fromLineNumber + 1);
return this._visibleLines.onLinesDeleted(e);
}
public override onLinesInserted(e: viewEvents.ViewLinesInsertedEvent): boolean {
CommandService.getInstance().executeCommand('membrane.textEditor.onLinesInserted', e.fromLineNumber, e.toLineNumber - e.fromLineNumber + 1);
return this._visibleLines.onLinesInserted(e);
}
public override onRevealRangeRequest(e: viewEvents.ViewRevealRangeRequestEvent): boolean {
Expand Down Expand Up @@ -665,6 +668,8 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
const adjustedScrollTop = this._context.viewLayout.getCurrentScrollTop() - viewportData.bigNumbersDelta;
this._linesContent.setTop(-adjustedScrollTop);
this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft());

CommandService.getInstance().executeCommand('membrane.textEditor.onScrollChanged', adjustedScrollTop, this._context.viewLayout.getCurrentScrollLeft());
}

// --- width
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/viewLayout/viewLineRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class ResolvedRenderLineInput {
}
}

function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput {
export function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput {
const lineContent = input.lineContent;

let isOverflowing: boolean;
Expand Down
9 changes: 9 additions & 0 deletions src/vs/workbench/services/commands/common/commandService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ export class CommandService extends Disposable implements ICommandService {
private readonly _onDidExecuteCommand: Emitter<ICommandEvent> = new Emitter<ICommandEvent>();
public readonly onDidExecuteCommand: Event<ICommandEvent> = this._onDidExecuteCommand.event;

// MEMBRANE: easy access to the singleton
private static _instance: CommandService;
public static getInstance(): ICommandService {
return CommandService._instance;
}

constructor(
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IExtensionService private readonly _extensionService: IExtensionService,
Expand All @@ -33,6 +39,9 @@ export class CommandService extends Disposable implements ICommandService {
super();
this._extensionService.whenInstalledExtensionsRegistered().then(value => this._extensionHostIsReady = value);
this._starActivation = null;

// MEMBRANE: easy access to the singleton
CommandService._instance = this;
}

private _activateStar(): Promise<void> {
Expand Down