Merge remote-tracking branch 'origin/master' into pine/alwaysShowInlineDetails

This commit is contained in:
Pine Wu
2020-01-21 09:49:54 +01:00
4 changed files with 50 additions and 13 deletions
@@ -68,11 +68,21 @@ class DocumentSemanticTokensProvider implements vscode.DocumentSemanticTokensPro
return null;
}
const versionBeforeRequest = document.version;
const response = await (this.client as ExperimentalProtocol.IExtendedTypeScriptServiceClient).execute('encodedSemanticClassifications-full', requestArg, token);
if (response.type !== 'response' || !response.body) {
return null;
}
const versionAfterRequest = document.version;
if (versionBeforeRequest !== versionAfterRequest) {
// cannot convert result's offsets to (line;col) values correctly
// a new request will come in soon...
return null;
}
const tokenSpan = response.body.spans;
const builder = new vscode.SemanticTokensBuilder();
+10
View File
@@ -25,6 +25,7 @@ export class FastDomNode<T extends HTMLElement> {
private _display: string;
private _position: string;
private _visibility: string;
private _backgroundColor: string;
private _layerHint: boolean;
private _contain: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'style' | 'paint';
@@ -47,6 +48,7 @@ export class FastDomNode<T extends HTMLElement> {
this._display = '';
this._position = '';
this._visibility = '';
this._backgroundColor = '';
this._layerHint = false;
this._contain = 'none';
}
@@ -200,6 +202,14 @@ export class FastDomNode<T extends HTMLElement> {
this.domNode.style.visibility = this._visibility;
}
public setBackgroundColor(backgroundColor: string): void {
if (this._backgroundColor === backgroundColor) {
return;
}
this._backgroundColor = backgroundColor;
this.domNode.style.backgroundColor = this._backgroundColor;
}
public setLayerHinting(layerHint: boolean): void {
if (this._layerHint === layerHint) {
return;
@@ -126,8 +126,8 @@ class MinimapOptions {
this.minimapWidth = layoutInfo.minimapWidth;
this.minimapHeight = layoutInfo.height;
this.canvasInnerWidth = Math.max(1, Math.floor(pixelRatio * this.minimapWidth));
this.canvasInnerHeight = Math.max(1, Math.floor(pixelRatio * this.minimapHeight));
this.canvasInnerWidth = Math.floor(pixelRatio * this.minimapWidth);
this.canvasInnerHeight = Math.floor(pixelRatio * this.minimapHeight);
this.canvasOuterWidth = this.canvasInnerWidth / pixelRatio;
this.canvasOuterHeight = this.canvasInnerHeight / pixelRatio;
@@ -657,16 +657,18 @@ export class Minimap extends ViewPart {
this._slider.setWidth(this._options.minimapWidth);
}
private _getBuffer(): ImageData {
private _getBuffer(): ImageData | null {
if (!this._buffers) {
this._buffers = new MinimapBuffers(
this._canvas.domNode.getContext('2d')!,
this._options.canvasInnerWidth,
this._options.canvasInnerHeight,
this._tokensColorTracker.getColor(ColorId.DefaultBackground)
);
if (this._options.canvasInnerWidth > 0 && this._options.canvasInnerHeight > 0) {
this._buffers = new MinimapBuffers(
this._canvas.domNode.getContext('2d')!,
this._options.canvasInnerWidth,
this._options.canvasInnerHeight,
this._tokensColorTracker.getColor(ColorId.DefaultBackground)
);
}
}
return this._buffers!.getBuffer();
return this._buffers ? this._buffers.getBuffer() : null;
}
private _onOptionsMaybeChanged(): boolean {
@@ -906,7 +908,7 @@ export class Minimap extends ViewPart {
canvasContext.fillRect(x, y, width, height);
}
private renderLines(layout: MinimapLayout): RenderData {
private renderLines(layout: MinimapLayout): RenderData | null {
const renderMinimap = this._options.renderMinimap;
const charRenderer = this._options.charRenderer();
const startLineNumber = layout.startLineNumber;
@@ -923,6 +925,10 @@ export class Minimap extends ViewPart {
// Oh well!! We need to repaint some lines...
const imageData = this._getBuffer();
if (!imageData) {
// 0 width or 0 height canvas, nothing to do
return null;
}
// Render untouched lines by using last rendered data.
let [_dirtyY1, _dirtyY2, needed] = Minimap._renderUntouchedLines(
@@ -74,8 +74,14 @@ class Settings {
this.right = position.right;
this.domWidth = position.width;
this.domHeight = position.height;
this.canvasWidth = (this.domWidth * this.pixelRatio) | 0;
this.canvasHeight = (this.domHeight * this.pixelRatio) | 0;
if (this.overviewRulerLanes === 0) {
// overview ruler is off
this.canvasWidth = 0;
this.canvasHeight = 0;
} else {
this.canvasWidth = (this.domWidth * this.pixelRatio) | 0;
this.canvasHeight = (this.domHeight * this.pixelRatio) | 0;
}
const [x, w] = this._initLanes(1, this.canvasWidth, this.overviewRulerLanes);
this.x = x;
@@ -303,6 +309,11 @@ export class DecorationsOverviewRuler extends ViewPart {
}
private _render(): void {
if (this._settings.overviewRulerLanes === 0) {
// overview ruler is off
this._domNode.setBackgroundColor(this._settings.backgroundColor ? this._settings.backgroundColor : '');
return;
}
const canvasWidth = this._settings.canvasWidth;
const canvasHeight = this._settings.canvasHeight;
const lineHeight = this._settings.lineHeight;