mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
remove warnings you cannot prevent, #18797
This commit is contained in:
@@ -199,7 +199,6 @@ export class MainThreadTextEditor {
|
||||
return;
|
||||
}
|
||||
this._lastSelection = selections.map(Selection.liftSelection);
|
||||
console.warn('setSelections on invisble editor');
|
||||
}
|
||||
|
||||
public getConfiguration(): IResolvedTextEditorConfiguration {
|
||||
@@ -239,26 +238,18 @@ export class MainThreadTextEditor {
|
||||
public setConfiguration(newConfiguration: ITextEditorConfigurationUpdate): void {
|
||||
this._setIndentConfiguration(newConfiguration);
|
||||
|
||||
if (!this._codeEditor) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (newConfiguration.cursorStyle) {
|
||||
let newCursorStyle = EditorCommon.cursorStyleToString(newConfiguration.cursorStyle);
|
||||
|
||||
if (!this._codeEditor) {
|
||||
console.warn('setConfiguration on invisible editor');
|
||||
return;
|
||||
}
|
||||
|
||||
this._codeEditor.updateOptions({
|
||||
cursorStyle: newCursorStyle
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof newConfiguration.lineNumbers !== 'undefined') {
|
||||
|
||||
if (!this._codeEditor) {
|
||||
console.warn('setConfiguration on invisible editor');
|
||||
return;
|
||||
}
|
||||
|
||||
let lineNumbers: 'on' | 'off' | 'relative';
|
||||
switch (newConfiguration.lineNumbers) {
|
||||
case TextEditorLineNumbersStyle.On:
|
||||
@@ -278,7 +269,6 @@ export class MainThreadTextEditor {
|
||||
|
||||
public setDecorations(key: string, ranges: EditorCommon.IDecorationOptions[]): void {
|
||||
if (!this._codeEditor) {
|
||||
console.warn('setDecorations on invisible editor');
|
||||
return;
|
||||
}
|
||||
this._codeEditor.setDecorations(key, ranges);
|
||||
@@ -286,7 +276,6 @@ export class MainThreadTextEditor {
|
||||
|
||||
public revealRange(range: EditorCommon.IRange, revealType: TextEditorRevealType): void {
|
||||
if (!this._codeEditor) {
|
||||
console.warn('revealRange on invisible editor');
|
||||
return;
|
||||
}
|
||||
switch (revealType) {
|
||||
@@ -303,7 +292,7 @@ export class MainThreadTextEditor {
|
||||
this._codeEditor.revealRangeAtTop(range);
|
||||
break;
|
||||
default:
|
||||
console.warn('Unknown revealType');
|
||||
console.warn(`Unknown revealType: ${revealType}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -361,40 +350,39 @@ export class MainThreadTextEditor {
|
||||
|
||||
public applyEdits(versionIdCheck: number, edits: EditorCommon.ISingleEditOperation[], opts: IApplyEditsOptions): boolean {
|
||||
if (this._model.getVersionId() !== versionIdCheck) {
|
||||
console.warn('Model has changed in the meantime!');
|
||||
// throw new Error('Model has changed in the meantime!');
|
||||
// model changed in the meantime
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._codeEditor) {
|
||||
if (opts.setEndOfLine === EndOfLine.CRLF) {
|
||||
this._model.setEOL(EditorCommon.EndOfLineSequence.CRLF);
|
||||
} else if (opts.setEndOfLine === EndOfLine.LF) {
|
||||
this._model.setEOL(EditorCommon.EndOfLineSequence.LF);
|
||||
}
|
||||
|
||||
let transformedEdits = edits.map((edit): EditorCommon.IIdentifiedSingleEditOperation => {
|
||||
return {
|
||||
identifier: null,
|
||||
range: Range.lift(edit.range),
|
||||
text: edit.text,
|
||||
forceMoveMarkers: edit.forceMoveMarkers
|
||||
};
|
||||
});
|
||||
|
||||
if (opts.undoStopBefore) {
|
||||
this._codeEditor.pushUndoStop();
|
||||
}
|
||||
this._codeEditor.executeEdits('MainThreadTextEditor', transformedEdits);
|
||||
if (opts.undoStopAfter) {
|
||||
this._codeEditor.pushUndoStop();
|
||||
}
|
||||
return true;
|
||||
if (!this._codeEditor) {
|
||||
// console.warn('applyEdits on invisible editor');
|
||||
return false;
|
||||
}
|
||||
|
||||
console.warn('applyEdits on invisible editor');
|
||||
return false;
|
||||
if (opts.setEndOfLine === EndOfLine.CRLF) {
|
||||
this._model.setEOL(EditorCommon.EndOfLineSequence.CRLF);
|
||||
} else if (opts.setEndOfLine === EndOfLine.LF) {
|
||||
this._model.setEOL(EditorCommon.EndOfLineSequence.LF);
|
||||
}
|
||||
|
||||
let transformedEdits = edits.map((edit): EditorCommon.IIdentifiedSingleEditOperation => {
|
||||
return {
|
||||
identifier: null,
|
||||
range: Range.lift(edit.range),
|
||||
text: edit.text,
|
||||
forceMoveMarkers: edit.forceMoveMarkers
|
||||
};
|
||||
});
|
||||
|
||||
if (opts.undoStopBefore) {
|
||||
this._codeEditor.pushUndoStop();
|
||||
}
|
||||
this._codeEditor.executeEdits('MainThreadTextEditor', transformedEdits);
|
||||
if (opts.undoStopAfter) {
|
||||
this._codeEditor.pushUndoStop();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
insertSnippet(template: string, ranges: EditorCommon.IRange[], opts: IUndoStopOptions) {
|
||||
|
||||
Reference in New Issue
Block a user