提交 df9d8e28 编写于 作者: J Johannes Rieken

remove warnings you cannot prevent, #18797

上级 dd039c37
......@@ -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 (!this._codeEditor) {
// console.warn('applyEdits on invisible editor');
return false;
}
if (opts.undoStopBefore) {
this._codeEditor.pushUndoStop();
}
this._codeEditor.executeEdits('MainThreadTextEditor', transformedEdits);
if (opts.undoStopAfter) {
this._codeEditor.pushUndoStop();
}
return true;
if (opts.setEndOfLine === EndOfLine.CRLF) {
this._model.setEOL(EditorCommon.EndOfLineSequence.CRLF);
} else if (opts.setEndOfLine === EndOfLine.LF) {
this._model.setEOL(EditorCommon.EndOfLineSequence.LF);
}
console.warn('applyEdits on invisible editor');
return false;
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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册