Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -58,7 +58,7 @@ export class LineDecoration {
continue;
}
if (range.isEmpty() && d.type === InlineDecorationType.Regular) {
if (range.isEmpty() && (d.type === InlineDecorationType.Regular || d.type === InlineDecorationType.RegularAffectingLetterSpacing)) {
// Ignore empty range decorations
continue;
}

View File

@@ -11,7 +11,7 @@ import { LinesLayout } from 'vs/editor/common/viewLayout/linesLayout';
import { IViewLayout, IViewWhitespaceViewportData, Viewport } from 'vs/editor/common/viewModel/viewModel';
import { IPartialViewLinesViewportData } from 'vs/editor/common/viewLayout/viewLinesViewportData';
import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer';
import Event from 'vs/base/common/event';
import { Event } from 'vs/base/common/event';
import { IConfigurationChangedEvent } from 'vs/editor/common/config/editorOptions';
const SMOOTH_SCROLLING_TIME = 125;
@@ -75,15 +75,12 @@ export class ViewLayout extends Disposable implements IViewLayout {
}
public onFlushed(lineCount: number): void {
this._linesLayout.onFlushed(lineCount);
this._updateHeight();
}
public onLinesDeleted(fromLineNumber: number, toLineNumber: number): void {
this._linesLayout.onLinesDeleted(fromLineNumber, toLineNumber);
this._updateHeight();
}
public onLinesInserted(fromLineNumber: number, toLineNumber: number): void {
this._linesLayout.onLinesInserted(fromLineNumber, toLineNumber);
this._updateHeight();
}
// ---- end view event handlers
@@ -163,7 +160,7 @@ export class ViewLayout extends Disposable implements IViewLayout {
// ---- view state
public saveState(): editorCommon.IViewState {
public saveState(): { scrollTop: number; scrollTopWithoutViewZones: number; scrollLeft: number; } {
const currentScrollPosition = this.scrollable.getFutureScrollPosition();
let scrollTop = currentScrollPosition.scrollTop;
let firstLineNumberInViewport = this._linesLayout.getLineNumberAtOrAfterVerticalOffset(scrollTop);
@@ -175,17 +172,6 @@ export class ViewLayout extends Disposable implements IViewLayout {
};
}
public reduceRestoreState(state: editorCommon.IViewState): { scrollLeft: number; scrollTop: number; } {
let restoreScrollTop = state.scrollTop;
if (typeof state.scrollTopWithoutViewZones === 'number' && !this._linesLayout.hasWhitespace()) {
restoreScrollTop = state.scrollTopWithoutViewZones;
}
return {
scrollLeft: state.scrollLeft,
scrollTop: restoreScrollTop
};
}
// ---- IVerticalLayoutProvider
public addWhitespace(afterLineNumber: number, ordinal: number, height: number): number {

View File

@@ -36,7 +36,8 @@ export class RenderLineInput {
public readonly useMonospaceOptimizations: boolean;
public readonly lineContent: string;
public readonly mightContainRTL: boolean;
public readonly isBasicASCII: boolean;
public readonly containsRTL: boolean;
public readonly fauxIndentLength: number;
public readonly lineTokens: IViewLineTokens;
public readonly lineDecorations: LineDecoration[];
@@ -50,7 +51,8 @@ export class RenderLineInput {
constructor(
useMonospaceOptimizations: boolean,
lineContent: string,
mightContainRTL: boolean,
isBasicASCII: boolean,
containsRTL: boolean,
fauxIndentLength: number,
lineTokens: IViewLineTokens,
lineDecorations: LineDecoration[],
@@ -63,7 +65,8 @@ export class RenderLineInput {
) {
this.useMonospaceOptimizations = useMonospaceOptimizations;
this.lineContent = lineContent;
this.mightContainRTL = mightContainRTL;
this.isBasicASCII = isBasicASCII;
this.containsRTL = containsRTL;
this.fauxIndentLength = fauxIndentLength;
this.lineTokens = lineTokens;
this.lineDecorations = lineDecorations;
@@ -85,7 +88,8 @@ export class RenderLineInput {
return (
this.useMonospaceOptimizations === other.useMonospaceOptimizations
&& this.lineContent === other.lineContent
&& this.mightContainRTL === other.mightContainRTL
&& this.isBasicASCII === other.isBasicASCII
&& this.containsRTL === other.containsRTL
&& this.fauxIndentLength === other.fauxIndentLength
&& this.tabSize === other.tabSize
&& this.spaceWidth === other.spaceWidth
@@ -217,14 +221,20 @@ export class CharacterMapping {
}
}
export const enum ForeignElementType {
None = 0,
Before = 1,
After = 2
}
export class RenderLineOutput {
_renderLineOutputBrand: void;
readonly characterMapping: CharacterMapping;
readonly containsRTL: boolean;
readonly containsForeignElements: boolean;
readonly containsForeignElements: ForeignElementType;
constructor(characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: boolean) {
constructor(characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: ForeignElementType) {
this.characterMapping = characterMapping;
this.containsRTL = containsRTL;
this.containsForeignElements = containsForeignElements;
@@ -234,7 +244,7 @@ export class RenderLineOutput {
export function renderViewLine(input: RenderLineInput, sb: IStringBuilder): RenderLineOutput {
if (input.lineContent.length === 0) {
let containsForeignElements = false;
let containsForeignElements = ForeignElementType.None;
// This is basically for IE's hit test to work
let content: string = '<span><span>\u00a0</span></span>';
@@ -244,13 +254,17 @@ export function renderViewLine(input: RenderLineInput, sb: IStringBuilder): Rend
let classNames: string[] = [];
for (let i = 0, len = input.lineDecorations.length; i < len; i++) {
const lineDecoration = input.lineDecorations[i];
if (lineDecoration.type !== InlineDecorationType.Regular) {
if (lineDecoration.type === InlineDecorationType.Before) {
classNames.push(input.lineDecorations[i].className);
containsForeignElements = true;
containsForeignElements |= ForeignElementType.Before;
}
if (lineDecoration.type === InlineDecorationType.After) {
classNames.push(input.lineDecorations[i].className);
containsForeignElements |= ForeignElementType.After;
}
}
if (containsForeignElements) {
if (containsForeignElements !== ForeignElementType.None) {
content = `<span><span class="${classNames.join(' ')}"></span></span>`;
}
}
@@ -271,7 +285,7 @@ export class RenderLineOutput2 {
public readonly characterMapping: CharacterMapping,
public readonly html: string,
public readonly containsRTL: boolean,
public readonly containsForeignElements: boolean
public readonly containsForeignElements: ForeignElementType
) {
}
}
@@ -289,7 +303,7 @@ class ResolvedRenderLineInput {
public readonly len: number,
public readonly isOverflowing: boolean,
public readonly parts: LinePart[],
public readonly containsForeignElements: boolean,
public readonly containsForeignElements: ForeignElementType,
public readonly tabSize: number,
public readonly containsRTL: boolean,
public readonly spaceWidth: number,
@@ -319,22 +333,22 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput
if (input.renderWhitespace === RenderWhitespace.All || input.renderWhitespace === RenderWhitespace.Boundary) {
tokens = _applyRenderWhitespace(lineContent, len, tokens, input.fauxIndentLength, input.tabSize, useMonospaceOptimizations, input.renderWhitespace === RenderWhitespace.Boundary);
}
let containsForeignElements = false;
let containsForeignElements = ForeignElementType.None;
if (input.lineDecorations.length > 0) {
for (let i = 0, len = input.lineDecorations.length; i < len; i++) {
const lineDecoration = input.lineDecorations[i];
if (lineDecoration.type !== InlineDecorationType.Regular) {
containsForeignElements = true;
break;
if (lineDecoration.type === InlineDecorationType.RegularAffectingLetterSpacing) {
// Pretend there are foreign elements... although not 100% accurate.
containsForeignElements |= ForeignElementType.Before;
} else if (lineDecoration.type === InlineDecorationType.Before) {
containsForeignElements |= ForeignElementType.Before;
} else if (lineDecoration.type === InlineDecorationType.After) {
containsForeignElements |= ForeignElementType.After;
}
}
tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);
}
let containsRTL = false;
if (input.mightContainRTL) {
containsRTL = strings.containsRTL(lineContent);
}
if (!containsRTL && !input.fontLigatures) {
if (input.isBasicASCII && !input.fontLigatures) {
tokens = splitLargeTokens(lineContent, tokens);
}
@@ -346,7 +360,7 @@ function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput
tokens,
containsForeignElements,
input.tabSize,
containsRTL,
input.containsRTL,
input.spaceWidth,
input.renderWhitespace,
input.renderControlCharacters
@@ -406,11 +420,6 @@ function splitLargeTokens(lineContent: string, tokens: LinePart[]): LinePart[] {
const piecesCount = Math.ceil(diff / Constants.LongToken);
for (let j = 1; j < piecesCount; j++) {
let pieceEndIndex = lastTokenEndIndex + (j * Constants.LongToken);
let lastCharInPiece = lineContent.charCodeAt(pieceEndIndex - 1);
if (strings.isHighSurrogate(lastCharInPiece)) {
// Don't cut in the middle of a surrogate pair
pieceEndIndex--;
}
result[resultLen++] = new LinePart(pieceEndIndex, tokenType);
}
result[resultLen++] = new LinePart(tokenEndIndex, tokenType);