Merge from vscode aba87f135229c17c4624341b7a2499dcedafcb87 (#6430)

* Merge from vscode aba87f135229c17c4624341b7a2499dcedafcb87

* fix compile errors
This commit is contained in:
Anthony Dresser
2019-07-18 18:32:57 -07:00
committed by GitHub
parent bf4815d364
commit ee3663c1cd
158 changed files with 3101 additions and 2361 deletions

View File

@@ -451,6 +451,7 @@ export class Minimap extends ViewPart {
private _options: MinimapOptions;
private _lastRenderData: RenderData | null;
private _lastDecorations: ViewModelDecoration[] | undefined;
private _renderDecorations: boolean = false;
private _buffers: MinimapBuffers | null;
@@ -675,6 +676,13 @@ export class Minimap extends ViewPart {
return true;
}
public onThemeChanged(e: viewEvents.ViewThemeChangedEvent): boolean {
this._context.model.invalidateMinimapColorCache();
// Only bother calling render if decorations are currently shown
this._renderDecorations = !!this._lastDecorations;
return !!this._lastDecorations;
}
// --- end event handlers
public prepareRender(ctx: RenderingContext): void {
@@ -751,6 +759,8 @@ export class Minimap extends ViewPart {
this.renderDecorationOnLine(canvasContext, lineOffsetMap, decoration, layout, line, height, lineHeight, tabSize, characterWidth);
}
}
this._lastDecorations = decorations;
}
}

View File

@@ -2703,6 +2703,10 @@ export class ModelDecorationMinimapOptions extends DecorationOptions {
return this._resolvedColor;
}
public invalidateCachedColor(): void {
this._resolvedColor = undefined;
}
private _resolveColor(color: string | ThemeColor, theme: ITheme): Color | undefined {
if (typeof color === 'string') {
return Color.fromHex(color);

View File

@@ -1285,7 +1285,7 @@ export interface CommentThread {
commentThreadHandle: number;
controllerHandle: number;
extensionId?: string;
threadId: string | null;
threadId: string;
resource: string | null;
range: IRange;
label: string;
@@ -1333,8 +1333,7 @@ export enum CommentMode {
* @internal
*/
export interface Comment {
readonly commentId: string;
readonly uniqueIdInThread?: number;
readonly uniqueIdInThread: number;
readonly body: IMarkdownString;
readonly userName: string;
readonly userIconPath?: string;

View File

@@ -5,7 +5,7 @@
import * as nls from 'vs/nls';
import { Color, RGBA } from 'vs/base/common/color';
import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder } from 'vs/platform/theme/common/colorRegistry';
import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
/**
@@ -31,7 +31,7 @@ export const editorRuler = registerColor('editorRuler.foreground', { dark: '#5A5
export const editorCodeLensForeground = registerColor('editorCodeLens.foreground', { dark: '#999999', light: '#999999', hc: '#999999' }, nls.localize('editorCodeLensForeground', 'Foreground color of editor code lenses'));
export const editorBracketMatchBackground = registerColor('editorBracketMatch.background', { dark: '#0064001a', light: '#0064001a', hc: '#0064001a' }, nls.localize('editorBracketMatchBackground', 'Background color behind matching brackets'));
export const editorBracketMatchBorder = registerColor('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hc: '#fff' }, nls.localize('editorBracketMatchBorder', 'Color for matching brackets boxes'));
export const editorBracketMatchBorder = registerColor('editorBracketMatch.border', { dark: '#888', light: '#B9B9B9', hc: contrastBorder }, nls.localize('editorBracketMatchBorder', 'Color for matching brackets boxes'));
export const editorOverviewRulerBorder = registerColor('editorOverviewRuler.border', { dark: '#7f7f7f4d', light: '#7f7f7f4d', hc: '#7f7f7f4d' }, nls.localize('editorOverviewRulerBorder', 'Color of the overview ruler border.'));

View File

@@ -141,6 +141,7 @@ export interface IViewModel {
getLineLastNonWhitespaceColumn(lineNumber: number): number;
getAllOverviewRulerDecorations(theme: ITheme): IOverviewRulerDecorations;
invalidateOverviewRulerColorCache(): void;
invalidateMinimapColorCache(): void;
getValueInRange(range: Range, eol: EndOfLinePreference): string;
getModelLineMaxColumn(modelLineNumber: number): number;

View File

@@ -11,7 +11,7 @@ import { IPosition, Position } from 'vs/editor/common/core/position';
import { IRange, Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { EndOfLinePreference, IActiveIndentGuideInfo, ITextModel, TrackedRangeStickiness, TextModelResolvedOptions } from 'vs/editor/common/model';
import { ModelDecorationOverviewRulerOptions } from 'vs/editor/common/model/textModel';
import { ModelDecorationOverviewRulerOptions, ModelDecorationMinimapOptions } from 'vs/editor/common/model/textModel';
import * as textModelEvents from 'vs/editor/common/model/textModelEvents';
import { ColorId, LanguageId, TokenizationRegistry } from 'vs/editor/common/modes';
import { tokenizeLineToHTML } from 'vs/editor/common/modes/textToHtmlTokenizer';
@@ -565,6 +565,16 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
}
}
public invalidateMinimapColorCache(): void {
const decorations = this.model.getAllDecorations();
for (const decoration of decorations) {
const opts = <ModelDecorationMinimapOptions>decoration.options.minimap;
if (opts) {
opts.invalidateCachedColor();
}
}
}
public getValueInRange(range: Range, eol: EndOfLinePreference): string {
const modelRange = this.coordinatesConverter.convertViewRangeToModelRange(range);
return this.model.getValueInRange(modelRange, eol);