mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 09:35:38 -05:00
Merge from vscode 8c426f9f3b6b18935cc6c2ec8aa6d45ccd88021e
This commit is contained in:
@@ -262,14 +262,6 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
|
||||
return Promise.reject(new Error('debug session not found'));
|
||||
}
|
||||
|
||||
public $terminateDebugSession(sessionId: DebugSessionUUID): Promise<void> {
|
||||
const session = this.debugService.getModel().getSession(sessionId, true);
|
||||
if (session) {
|
||||
return session.terminate();
|
||||
}
|
||||
return Promise.reject(new Error('debug session not found'));
|
||||
}
|
||||
|
||||
public $stopDebugging(sessionId: DebugSessionUUID | undefined): Promise<void> {
|
||||
if (sessionId) {
|
||||
const session = this.debugService.getModel().getSession(sessionId, true);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -128,7 +128,7 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
|
||||
}
|
||||
}
|
||||
|
||||
$onExtensionHostExit(code: number): void {
|
||||
async $onExtensionHostExit(code: number): Promise<void> {
|
||||
this._extensionService._onExtensionHostExit(code);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user