mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 09:38:26 -05:00
Merge from vscode 8c426f9f3b6b18935cc6c2ec8aa6d45ccd88021e
This commit is contained in:
@@ -269,6 +269,14 @@ export class MainThreadTextEditor {
|
||||
}
|
||||
}));
|
||||
|
||||
const isValidCodeEditor = () => {
|
||||
// Due to event timings, it is possible that there is a model change event not yet delivered to us.
|
||||
// > e.g. a model change event is emitted to a listener which then decides to update editor options
|
||||
// > In this case the editor configuration change event reaches us first.
|
||||
// So simply check that the model is still attached to this code editor
|
||||
return (this._codeEditor && this._codeEditor.getModel() === this._model);
|
||||
};
|
||||
|
||||
const updateProperties = (selectionChangeSource: string | null) => {
|
||||
// Some editor events get delivered faster than model content changes. This is
|
||||
// problematic, as this leads to editor properties reaching the extension host
|
||||
@@ -287,18 +295,30 @@ export class MainThreadTextEditor {
|
||||
|
||||
this._codeEditorListeners.add(this._codeEditor.onDidChangeCursorSelection((e) => {
|
||||
// selection
|
||||
if (!isValidCodeEditor()) {
|
||||
return;
|
||||
}
|
||||
updateProperties(e.source);
|
||||
}));
|
||||
this._codeEditorListeners.add(this._codeEditor.onDidChangeConfiguration(() => {
|
||||
this._codeEditorListeners.add(this._codeEditor.onDidChangeConfiguration((e) => {
|
||||
// options
|
||||
if (!isValidCodeEditor()) {
|
||||
return;
|
||||
}
|
||||
updateProperties(null);
|
||||
}));
|
||||
this._codeEditorListeners.add(this._codeEditor.onDidLayoutChange(() => {
|
||||
// visibleRanges
|
||||
if (!isValidCodeEditor()) {
|
||||
return;
|
||||
}
|
||||
updateProperties(null);
|
||||
}));
|
||||
this._codeEditorListeners.add(this._codeEditor.onDidScrollChange(() => {
|
||||
// visibleRanges
|
||||
if (!isValidCodeEditor()) {
|
||||
return;
|
||||
}
|
||||
updateProperties(null);
|
||||
}));
|
||||
this._updatePropertiesNow(null);
|
||||
|
||||
Reference in New Issue
Block a user