diff --git a/webapp/packages/plugin-data-viewer/src/FetchTableDataAsyncProcess.ts b/webapp/packages/plugin-data-viewer/src/FetchTableDataAsyncProcess.ts index b924ade18a..dc7f478777 100644 --- a/webapp/packages/plugin-data-viewer/src/FetchTableDataAsyncProcess.ts +++ b/webapp/packages/plugin-data-viewer/src/FetchTableDataAsyncProcess.ts @@ -39,7 +39,7 @@ export class FetchTableDataAsyncProcess extends Deferred { filter: SqlDataFilter, dataFormat?: ResultDataFormat, ): Promise { - // start async task} + // start async task try { const taskInfo = await this.executeQueryAsync(tableDataParams, filter, dataFormat); await this.applyResult(taskInfo); diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorController.tsx b/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorController.tsx index 3dea85f881..1bd5177a59 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorController.tsx +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/SqlEditorController.tsx @@ -14,7 +14,6 @@ import type { Hints, ShowHintOptions, HintFunction, - LineHandle, } from 'codemirror'; import { observable, computed, makeObservable, autorun } from 'mobx'; import type { IControlledCodeMirror } from 'react-codemirror2'; @@ -363,6 +362,7 @@ export class SqlEditorController implements IInitializableController { const ignoredChanges = ['+delete', 'undo', 'complete']; + // TODO: probably should be moved to SQLCodeEditorController editor.on('changes', (cm, changes) => { this.resetLineStateHighlight(); if (!this.activeSuggest || editor.state.completionActive) { @@ -383,6 +383,7 @@ export class SqlEditorController implements IInitializableController { this.showHint(true); }); + // TODO: probably should be moved to SQLCodeEditorController editor.on('cursorActivity', () => { const newCursor = editor.getCursor('from'); this.cursor = { ...newCursor }; @@ -402,10 +403,6 @@ export class SqlEditorController implements IInitializableController { private highlightActiveQuery() { this.highlightSegment(true); - if (!this.dialect) { - return; - } - const query = this.getSubQuery(); if (query) { @@ -451,23 +448,6 @@ export class SqlEditorController implements IInitializableController { className: 'active-query', } ); - - // if (typeof from === 'object') { - // if (state) { - // this.editor?.addLineClass(from, 'background', 'active-query'); - // } else { - // this.editor?.removeLineClass(from, 'background', 'active-query'); - // } - // return; - // } - - // for (let line = from; line <= to; line++) { - // if (state) { - // this.editor?.addLineClass(line, 'background', 'active-query'); - // } else { - // this.editor?.removeLineClass(line, 'background', 'active-query'); - // } - // } } private highlightExecutingLine(line: number, state: boolean): void { @@ -493,6 +473,7 @@ export class SqlEditorController implements IInitializableController { return undefined; } + // TODO: should be moved to SQLParser if (this.dialect?.scriptDelimiter && query.query.endsWith(this.dialect?.scriptDelimiter)) { query.query = query.query.slice(0, query.query.length - this.dialect.scriptDelimiter.length); } @@ -504,7 +485,7 @@ export class SqlEditorController implements IInitializableController { private handleQueryChange(editor: Editor, data: EditorChange, query: string) { if (this.readonly) { - (data as any).cancel(); + (data as any).cancel(); // seems it doesn't works, after disabling read-only mode, typings appears return; } this.tab.handlerState.query = query;