mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
improvement for the editor crash issue (#17278)
* handle the query editor crash issue * update message
This commit is contained in:
@@ -23,6 +23,8 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
|
|||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
|
import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
|
||||||
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
class MessagesView extends Disposable implements IPanelView {
|
class MessagesView extends Disposable implements IPanelView {
|
||||||
private messagePanel: MessagePanel;
|
private messagePanel: MessagePanel;
|
||||||
@@ -170,7 +172,9 @@ export class QueryResultsView extends Disposable {
|
|||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
@IThemeService themeService: IThemeService,
|
@IThemeService themeService: IThemeService,
|
||||||
@IInstantiationService private instantiationService: IInstantiationService,
|
@IInstantiationService private instantiationService: IInstantiationService,
|
||||||
@IQueryModelService private queryModelService: IQueryModelService
|
@IQueryModelService private queryModelService: IQueryModelService,
|
||||||
|
@INotificationService private notificationService: INotificationService,
|
||||||
|
@ILogService private logService: ILogService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.resultsTab = this._register(new ResultsTab(instantiationService));
|
this.resultsTab = this._register(new ResultsTab(instantiationService));
|
||||||
@@ -312,6 +316,13 @@ export class QueryResultsView extends Disposable {
|
|||||||
dynamicTab.captureState(input.state.dynamicModelViewTabsState);
|
dynamicTab.captureState(input.state.dynamicModelViewTabsState);
|
||||||
});
|
});
|
||||||
let info = this.queryModelService._getQueryInfo(input.uri) || this.queryModelService._getQueryInfo(URI.parse(input.uri).toString(true));
|
let info = this.queryModelService._getQueryInfo(input.uri) || this.queryModelService._getQueryInfo(URI.parse(input.uri).toString(true));
|
||||||
|
|
||||||
|
if (info?.queryRunner?.isDisposed) {
|
||||||
|
this.logService.error(`The query runner for '${input.uri}' has been disposed.`);
|
||||||
|
this.notificationService.error(nls.localize('queryResults.queryEditorCrashError', "The query editor ran into an issue and has stopped working. Please save and reopen it."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (info?.queryRunner) {
|
if (info?.queryRunner) {
|
||||||
this.setQueryRunner(info.queryRunner);
|
this.setQueryRunner(info.queryRunner);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -104,6 +104,12 @@ export default class QueryRunner extends Disposable {
|
|||||||
return this._hasCompleted;
|
return this._hasCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _isDisposed: boolean = false;
|
||||||
|
|
||||||
|
get isDisposed(): boolean {
|
||||||
|
return this._isDisposed;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For public use only, for private use, directly access the member
|
* For public use only, for private use, directly access the member
|
||||||
*/
|
*/
|
||||||
@@ -417,8 +423,10 @@ export default class QueryRunner extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override dispose() {
|
public override dispose() {
|
||||||
|
this.logService.info(`Disposing the query runner of: '${this.uri}'', call stack: ${new Error().stack}`);
|
||||||
this._batchSets = undefined!;
|
this._batchSets = undefined!;
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
this._isDisposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeConnectionUri(oldUri: string, newUri: string): Promise<void> {
|
public changeConnectionUri(oldUri: string, newUri: string): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user