mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 02:48:30 -05:00
Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)
* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 * Fix test build break * Update distro * Fix build errors * Update distro * Update REH build file * Update build task names for REL * Fix product build yaml * Fix product REH task name * Fix type in task name * Update linux build step * Update windows build tasks * Turn off server publish * Disable REH * Fix typo * Bump distro * Update vscode tests * Bump distro * Fix type in disto * Bump distro * Turn off docker build * Remove docker step from release Co-authored-by: ADS Merger <andresse@microsoft.com> Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
@@ -4,7 +4,10 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { LRUCache } from 'vs/base/common/map';
|
||||
import { MovingAverage } from 'vs/base/common/numbers';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
import { LanguageSelector, score } from 'vs/editor/common/modes/languageSelector';
|
||||
import { shouldSynchronizeModel } from 'vs/editor/common/services/modelService';
|
||||
@@ -174,3 +177,48 @@ export class LanguageFeatureRegistry<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Keeps moving average per model and set of providers so that requests
|
||||
* can be debounce according to the provider performance
|
||||
*/
|
||||
export class LanguageFeatureRequestDelays {
|
||||
|
||||
private readonly _cache = new LRUCache<string, MovingAverage>(50, 0.7);
|
||||
|
||||
constructor(
|
||||
private readonly _registry: LanguageFeatureRegistry<any>,
|
||||
readonly min: number,
|
||||
readonly max: number = Number.MAX_SAFE_INTEGER,
|
||||
) { }
|
||||
|
||||
private _key(model: ITextModel): string {
|
||||
return model.id + hash(this._registry.all(model));
|
||||
}
|
||||
|
||||
private _clamp(value: number | undefined): number {
|
||||
if (value === undefined) {
|
||||
return this.min;
|
||||
} else {
|
||||
return Math.min(this.max, Math.max(this.min, Math.floor(value * 1.3)));
|
||||
}
|
||||
}
|
||||
|
||||
get(model: ITextModel): number {
|
||||
const key = this._key(model);
|
||||
const avg = this._cache.get(key);
|
||||
return this._clamp(avg?.value);
|
||||
}
|
||||
|
||||
update(model: ITextModel, value: number): number {
|
||||
const key = this._key(model);
|
||||
let avg = this._cache.get(key);
|
||||
if (!avg) {
|
||||
avg = new MovingAverage();
|
||||
this._cache.set(key, avg);
|
||||
}
|
||||
avg.update(value);
|
||||
return this.get(model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,14 +395,14 @@ export class ThemeTrieElement {
|
||||
}
|
||||
}
|
||||
|
||||
export function generateTokensCSSForColorMap(colorMap: Color[]): string {
|
||||
export function generateTokensCSSForColorMap(colorMap: readonly Color[]): string {
|
||||
let rules: string[] = [];
|
||||
for (let i = 1, len = colorMap.length; i < len; i++) {
|
||||
let color = colorMap[i];
|
||||
rules[i] = `.monaco-editor .mtk${i} { color: ${color}; }`;
|
||||
rules[i] = `.mtk${i} { color: ${color}; }`;
|
||||
}
|
||||
rules.push('.monaco-editor .mtki { font-style: italic; }');
|
||||
rules.push('.monaco-editor .mtkb { font-weight: bold; }');
|
||||
rules.push('.monaco-editor .mtku { text-decoration: underline; text-underline-position: under; }');
|
||||
rules.push('.mtki { font-style: italic; }');
|
||||
rules.push('.mtkb { font-weight: bold; }');
|
||||
rules.push('.mtku { text-decoration: underline; text-underline-position: under; }');
|
||||
return rules.join('\n');
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IMarkerService, IMarker, MarkerSeverity, MarkerTag } from 'vs/platform/markers/common/markers';
|
||||
import { Disposable, toDisposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IModelDeltaDecoration, ITextModel, IModelDecorationOptions, TrackedRangeStickiness, OverviewRulerLane, IModelDecoration, MinimapPosition, IModelDecorationMinimapOptions } from 'vs/editor/common/model';
|
||||
import { ClassName } from 'vs/editor/common/model/intervalTree';
|
||||
@@ -16,7 +16,6 @@ import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDeco
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { minimapWarning, minimapError } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Delayer } from 'vs/base/common/async';
|
||||
|
||||
function MODEL_ID(resource: URI): string {
|
||||
return resource.toString();
|
||||
@@ -36,10 +35,6 @@ class MarkerDecorations extends Disposable {
|
||||
}));
|
||||
}
|
||||
|
||||
register<T extends IDisposable>(t: T): T {
|
||||
return super._register(t);
|
||||
}
|
||||
|
||||
public update(markers: IMarker[], newDecorations: IModelDeltaDecoration[]): boolean {
|
||||
const oldIds = [...this._markersData.keys()];
|
||||
this._markersData.clear();
|
||||
@@ -114,8 +109,6 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor
|
||||
private _onModelAdded(model: ITextModel): void {
|
||||
const markerDecorations = new MarkerDecorations(model);
|
||||
this._markerDecorations.set(MODEL_ID(model.uri), markerDecorations);
|
||||
const delayer = markerDecorations.register(new Delayer(100));
|
||||
markerDecorations.register(model.onDidChangeContent(() => delayer.trigger(() => this._updateDecorations(markerDecorations))));
|
||||
this._updateDecorations(markerDecorations);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
import { IConfiguration } from 'vs/editor/common/editorCommon';
|
||||
import { ViewEventHandler } from 'vs/editor/common/viewModel/viewEventHandler';
|
||||
import { IViewLayout, IViewModel } from 'vs/editor/common/viewModel/viewModel';
|
||||
import { IColorTheme, ThemeType } from 'vs/platform/theme/common/themeService';
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ColorIdentifier } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
|
||||
export class EditorTheme {
|
||||
|
||||
private _theme: IColorTheme;
|
||||
|
||||
public get type(): ThemeType {
|
||||
public get type(): ColorScheme {
|
||||
return this._theme.type;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user