mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 817eb6b0c720a4ecbc13c020afbbebfed667aa09 (#7356)
This commit is contained in:
@@ -424,7 +424,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
|
||||
return this._cursors.getPrimaryCursor().modelState.position;
|
||||
}
|
||||
|
||||
public setSelections(source: string, selections: ISelection[]): void {
|
||||
public setSelections(source: string, selections: readonly ISelection[]): void {
|
||||
this.setStates(source, CursorChangeReason.NotSet, CursorState.fromModelSelections(selections));
|
||||
}
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ export class CursorState {
|
||||
return CursorState.fromModelState(modelState);
|
||||
}
|
||||
|
||||
public static fromModelSelections(modelSelections: ISelection[]): PartialModelCursorState[] {
|
||||
public static fromModelSelections(modelSelections: readonly ISelection[]): PartialModelCursorState[] {
|
||||
let states: PartialModelCursorState[] = [];
|
||||
for (let i = 0, len = modelSelections.length; i < len; i++) {
|
||||
states[i] = this.fromModelSelection(modelSelections[i]);
|
||||
|
||||
@@ -389,7 +389,7 @@ export interface IEditor {
|
||||
* Set the selections for all the cursors of the editor.
|
||||
* Cursors will be removed or added, as necessary.
|
||||
*/
|
||||
setSelections(selections: ISelection[]): void;
|
||||
setSelections(selections: readonly ISelection[]): void;
|
||||
|
||||
/**
|
||||
* Scroll vertically as necessary and reveal lines.
|
||||
|
||||
@@ -32,9 +32,6 @@ export class LanguageFeatureRegistry<T> {
|
||||
private readonly _entries: Entry<T>[] = [];
|
||||
private readonly _onDidChange = new Emitter<number>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
get onDidChange(): Event<number> {
|
||||
return this._onDidChange.event;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { FrankensteinMode } from 'vs/editor/common/modes/abstractMode';
|
||||
import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode';
|
||||
import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry';
|
||||
import { ILanguageSelection, IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { firstOrDefault } from 'vs/base/common/arrays';
|
||||
|
||||
class LanguageSelection extends Disposable implements ILanguageSelection {
|
||||
|
||||
@@ -96,22 +97,12 @@ export class ModeServiceImpl implements IModeService {
|
||||
|
||||
public getModeIdByFilepathOrFirstLine(resource: URI | null, firstLine?: string): string | null {
|
||||
const modeIds = this._registry.getModeIdsFromFilepathOrFirstLine(resource, firstLine);
|
||||
|
||||
if (modeIds.length > 0) {
|
||||
return modeIds[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
return firstOrDefault(modeIds, null);
|
||||
}
|
||||
|
||||
public getModeId(commaSeparatedMimetypesOrCommaSeparatedIds: string | undefined): string | null {
|
||||
const modeIds = this._registry.extractModeIds(commaSeparatedMimetypesOrCommaSeparatedIds);
|
||||
|
||||
if (modeIds.length > 0) {
|
||||
return modeIds[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
return firstOrDefault(modeIds, null);
|
||||
}
|
||||
|
||||
public getLanguageIdentifier(modeId: string | LanguageId): LanguageIdentifier | null {
|
||||
@@ -164,12 +155,7 @@ export class ModeServiceImpl implements IModeService {
|
||||
|
||||
private _getModeIdByLanguageName(languageName: string): string | null {
|
||||
const modeIds = this._registry.getModeIdsFromLanguageName(languageName);
|
||||
|
||||
if (modeIds.length > 0) {
|
||||
return modeIds[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
return firstOrDefault(modeIds, null);
|
||||
}
|
||||
|
||||
private _getOrCreateMode(modeId: string): IMode {
|
||||
|
||||
@@ -19,7 +19,7 @@ export class MinimapTokensColorTracker {
|
||||
private _colors!: RGBA8[];
|
||||
private _backgroundIsLight!: boolean;
|
||||
|
||||
private _onDidChange = new Emitter<void>();
|
||||
private readonly _onDidChange = new Emitter<void>();
|
||||
public readonly onDidChange: Event<void> = this._onDidChange.event;
|
||||
|
||||
private constructor() {
|
||||
|
||||
@@ -244,9 +244,6 @@ export class ViewTokensChangedEvent {
|
||||
export class ViewThemeChangedEvent {
|
||||
|
||||
public readonly type = ViewEventType.ViewThemeChanged;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
export class ViewTokensColorsChangedEvent {
|
||||
@@ -270,9 +267,6 @@ export class ViewZonesChangedEvent {
|
||||
export class ViewLanguageConfigurationEvent {
|
||||
|
||||
public readonly type = ViewEventType.ViewLanguageConfigurationChanged;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
export type ViewEvent = (
|
||||
|
||||
@@ -1401,9 +1401,6 @@ class OverviewRulerDecorations {
|
||||
|
||||
readonly result: IOverviewRulerDecorations = Object.create(null);
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
public accept(color: string, startLineNumber: number, endLineNumber: number, lane: number): void {
|
||||
let prev = this.result[color];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user