mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 09:35:40 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -16,6 +16,7 @@ import { SnippetController2 } from 'vs/editor/contrib/snippet/snippetController2
|
||||
import { IApplyEditsOptions, IEditorPropertiesChangeData, IResolvedTextEditorConfiguration, ITextEditorConfigurationUpdate, IUndoStopOptions, TextEditorRevealType } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { EndOfLine, TextEditorLineNumbersStyle } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { IEditor } from 'vs/workbench/common/editor';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
export interface IFocusTracker {
|
||||
onGainedFocus(): void;
|
||||
@@ -24,14 +25,14 @@ export interface IFocusTracker {
|
||||
|
||||
export class MainThreadTextEditorProperties {
|
||||
|
||||
public static readFromEditor(previousProperties: MainThreadTextEditorProperties, model: ITextModel, codeEditor: ICodeEditor): MainThreadTextEditorProperties {
|
||||
public static readFromEditor(previousProperties: MainThreadTextEditorProperties | null, model: ITextModel, codeEditor: ICodeEditor | null): MainThreadTextEditorProperties {
|
||||
const selections = MainThreadTextEditorProperties._readSelectionsFromCodeEditor(previousProperties, codeEditor);
|
||||
const options = MainThreadTextEditorProperties._readOptionsFromCodeEditor(previousProperties, model, codeEditor);
|
||||
const visibleRanges = MainThreadTextEditorProperties._readVisibleRangesFromCodeEditor(previousProperties, codeEditor);
|
||||
return new MainThreadTextEditorProperties(selections, options, visibleRanges);
|
||||
}
|
||||
|
||||
private static _readSelectionsFromCodeEditor(previousProperties: MainThreadTextEditorProperties, codeEditor: ICodeEditor): Selection[] {
|
||||
private static _readSelectionsFromCodeEditor(previousProperties: MainThreadTextEditorProperties | null, codeEditor: ICodeEditor | null): Selection[] {
|
||||
let result: Selection[] | null = null;
|
||||
if (codeEditor) {
|
||||
result = codeEditor.getSelections();
|
||||
@@ -45,10 +46,14 @@ export class MainThreadTextEditorProperties {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static _readOptionsFromCodeEditor(previousProperties: MainThreadTextEditorProperties, model: ITextModel, codeEditor: ICodeEditor): IResolvedTextEditorConfiguration {
|
||||
private static _readOptionsFromCodeEditor(previousProperties: MainThreadTextEditorProperties | null, model: ITextModel, codeEditor: ICodeEditor | null): IResolvedTextEditorConfiguration {
|
||||
if (model.isDisposed()) {
|
||||
// shutdown time
|
||||
return previousProperties.options;
|
||||
if (previousProperties) {
|
||||
// shutdown time
|
||||
return previousProperties.options;
|
||||
} else {
|
||||
throw new Error('No valid properties');
|
||||
}
|
||||
}
|
||||
|
||||
let cursorStyle: TextEditorCursorStyle;
|
||||
@@ -80,12 +85,13 @@ export class MainThreadTextEditorProperties {
|
||||
return {
|
||||
insertSpaces: modelOptions.insertSpaces,
|
||||
tabSize: modelOptions.tabSize,
|
||||
indentSize: modelOptions.indentSize,
|
||||
cursorStyle: cursorStyle,
|
||||
lineNumbers: lineNumbers
|
||||
};
|
||||
}
|
||||
|
||||
private static _readVisibleRangesFromCodeEditor(previousProperties: MainThreadTextEditorProperties, codeEditor: ICodeEditor): Range[] {
|
||||
private static _readVisibleRangesFromCodeEditor(previousProperties: MainThreadTextEditorProperties | null, codeEditor: ICodeEditor | null): Range[] {
|
||||
if (codeEditor) {
|
||||
return codeEditor.getVisibleRanges();
|
||||
}
|
||||
@@ -99,8 +105,8 @@ export class MainThreadTextEditorProperties {
|
||||
) {
|
||||
}
|
||||
|
||||
public generateDelta(oldProps: MainThreadTextEditorProperties, selectionChangeSource: string): IEditorPropertiesChangeData {
|
||||
let delta: IEditorPropertiesChangeData = {
|
||||
public generateDelta(oldProps: MainThreadTextEditorProperties | null, selectionChangeSource: string | null): IEditorPropertiesChangeData | null {
|
||||
const delta: IEditorPropertiesChangeData = {
|
||||
options: null,
|
||||
selections: null,
|
||||
visibleRanges: null
|
||||
@@ -109,7 +115,7 @@ export class MainThreadTextEditorProperties {
|
||||
if (!oldProps || !MainThreadTextEditorProperties._selectionsEqual(oldProps.selections, this.selections)) {
|
||||
delta.selections = {
|
||||
selections: this.selections,
|
||||
source: selectionChangeSource
|
||||
source: withNullAsUndefined(selectionChangeSource)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -162,6 +168,7 @@ export class MainThreadTextEditorProperties {
|
||||
}
|
||||
return (
|
||||
a.tabSize === b.tabSize
|
||||
&& a.indentSize === b.indentSize
|
||||
&& a.insertSpaces === b.insertSpaces
|
||||
&& a.cursorStyle === b.cursorStyle
|
||||
&& a.lineNumbers === b.lineNumbers
|
||||
@@ -175,12 +182,12 @@ export class MainThreadTextEditorProperties {
|
||||
*/
|
||||
export class MainThreadTextEditor {
|
||||
|
||||
private _id: string;
|
||||
private readonly _id: string;
|
||||
private _model: ITextModel;
|
||||
private _modelService: IModelService;
|
||||
private readonly _modelService: IModelService;
|
||||
private _modelListeners: IDisposable[];
|
||||
private _codeEditor: ICodeEditor;
|
||||
private _focusTracker: IFocusTracker;
|
||||
private _codeEditor: ICodeEditor | null;
|
||||
private readonly _focusTracker: IFocusTracker;
|
||||
private _codeEditorListeners: IDisposable[];
|
||||
|
||||
private _properties: MainThreadTextEditorProperties;
|
||||
@@ -200,7 +207,6 @@ export class MainThreadTextEditor {
|
||||
this._modelService = modelService;
|
||||
this._codeEditorListeners = [];
|
||||
|
||||
this._properties = null;
|
||||
this._onPropertiesChanged = new Emitter<IEditorPropertiesChangeData>();
|
||||
|
||||
this._modelListeners = [];
|
||||
@@ -213,20 +219,20 @@ export class MainThreadTextEditor {
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
this._model = null;
|
||||
this._model = null!;
|
||||
this._modelListeners = dispose(this._modelListeners);
|
||||
this._codeEditor = null;
|
||||
this._codeEditorListeners = dispose(this._codeEditorListeners);
|
||||
}
|
||||
|
||||
private _updatePropertiesNow(selectionChangeSource: string): void {
|
||||
private _updatePropertiesNow(selectionChangeSource: string | null): void {
|
||||
this._setProperties(
|
||||
MainThreadTextEditorProperties.readFromEditor(this._properties, this._model, this._codeEditor),
|
||||
selectionChangeSource
|
||||
);
|
||||
}
|
||||
|
||||
private _setProperties(newProperties: MainThreadTextEditorProperties, selectionChangeSource: string): void {
|
||||
private _setProperties(newProperties: MainThreadTextEditorProperties, selectionChangeSource: string | null): void {
|
||||
const delta = newProperties.generateDelta(this._properties, selectionChangeSource);
|
||||
this._properties = newProperties;
|
||||
if (delta) {
|
||||
@@ -242,15 +248,15 @@ export class MainThreadTextEditor {
|
||||
return this._model;
|
||||
}
|
||||
|
||||
public getCodeEditor(): ICodeEditor {
|
||||
public getCodeEditor(): ICodeEditor | null {
|
||||
return this._codeEditor;
|
||||
}
|
||||
|
||||
public hasCodeEditor(codeEditor: ICodeEditor): boolean {
|
||||
public hasCodeEditor(codeEditor: ICodeEditor | null): boolean {
|
||||
return (this._codeEditor === codeEditor);
|
||||
}
|
||||
|
||||
public setCodeEditor(codeEditor: ICodeEditor): void {
|
||||
public setCodeEditor(codeEditor: ICodeEditor | null): void {
|
||||
if (this.hasCodeEditor(codeEditor)) {
|
||||
// Nothing to do...
|
||||
return;
|
||||
@@ -318,10 +324,10 @@ export class MainThreadTextEditor {
|
||||
}
|
||||
|
||||
private _setIndentConfiguration(newConfiguration: ITextEditorConfigurationUpdate): void {
|
||||
const creationOpts = this._modelService.getCreationOptions(this._model.getLanguageIdentifier().language, this._model.uri, this._model.isForSimpleWidget);
|
||||
|
||||
if (newConfiguration.tabSize === 'auto' || newConfiguration.insertSpaces === 'auto') {
|
||||
// one of the options was set to 'auto' => detect indentation
|
||||
|
||||
let creationOpts = this._modelService.getCreationOptions(this._model.getLanguageIdentifier().language, this._model.uri, this._model.isForSimpleWidget);
|
||||
let insertSpaces = creationOpts.insertSpaces;
|
||||
let tabSize = creationOpts.tabSize;
|
||||
|
||||
@@ -337,13 +343,20 @@ export class MainThreadTextEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
let newOpts: ITextModelUpdateOptions = {};
|
||||
const newOpts: ITextModelUpdateOptions = {};
|
||||
if (typeof newConfiguration.insertSpaces !== 'undefined') {
|
||||
newOpts.insertSpaces = newConfiguration.insertSpaces;
|
||||
}
|
||||
if (typeof newConfiguration.tabSize !== 'undefined') {
|
||||
newOpts.tabSize = newConfiguration.tabSize;
|
||||
}
|
||||
if (typeof newConfiguration.indentSize !== 'undefined') {
|
||||
if (newConfiguration.indentSize === 'tabSize') {
|
||||
newOpts.indentSize = newOpts.tabSize || creationOpts.tabSize;
|
||||
} else {
|
||||
newOpts.indentSize = newConfiguration.indentSize;
|
||||
}
|
||||
}
|
||||
this._model.updateOptions(newOpts);
|
||||
}
|
||||
|
||||
@@ -355,7 +368,7 @@ export class MainThreadTextEditor {
|
||||
}
|
||||
|
||||
if (newConfiguration.cursorStyle) {
|
||||
let newCursorStyle = cursorStyleToString(newConfiguration.cursorStyle);
|
||||
const newCursorStyle = cursorStyleToString(newConfiguration.cursorStyle);
|
||||
this._codeEditor.updateOptions({
|
||||
cursorStyle: newCursorStyle
|
||||
});
|
||||
@@ -390,7 +403,7 @@ export class MainThreadTextEditor {
|
||||
if (!this._codeEditor) {
|
||||
return;
|
||||
}
|
||||
let ranges: Range[] = [];
|
||||
const ranges: Range[] = [];
|
||||
for (let i = 0, len = Math.floor(_ranges.length / 4); i < len; i++) {
|
||||
ranges[i] = new Range(_ranges[4 * i], _ranges[4 * i + 1], _ranges[4 * i + 2], _ranges[4 * i + 3]);
|
||||
}
|
||||
@@ -452,7 +465,7 @@ export class MainThreadTextEditor {
|
||||
this._model.pushEOL(EndOfLineSequence.LF);
|
||||
}
|
||||
|
||||
let transformedEdits = edits.map((edit): IIdentifiedSingleEditOperation => {
|
||||
const transformedEdits = edits.map((edit): IIdentifiedSingleEditOperation => {
|
||||
return {
|
||||
range: Range.lift(edit.range),
|
||||
text: edit.text,
|
||||
|
||||
Reference in New Issue
Block a user