Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5185 SQL Editor queries highlighting is broken #2842

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d801125
CB-5185 adds script parsing on cursor change
sergeyteleshev Aug 14, 2024
50b5420
Revert "CB-5185 adds script parsing on cursor change"
sergeyteleshev Aug 14, 2024
a99cdfc
chore: remove commented out code in _base-code-editor.scss
sergeyteleshev Aug 14, 2024
1def9f8
chore: Refactor SQLCodeEditorPanel to improve performance and readabi…
sergeyteleshev Aug 14, 2024
9384769
Refactor SQLCodeEditorPanel to improve performance
sergeyteleshev Aug 14, 2024
9a032a8
CB-5185 renames delete method for UsersResource so there is no name c…
sergeyteleshev Aug 14, 2024
f7b5ed4
refactor: rename delete method in UsersResource to avoid name collision
sergeyteleshev Aug 15, 2024
eaf5646
Merge branch 'devel' into CB-5185-sql-editor-queries-highlighting-is-…
EvgeniaBzzz Aug 20, 2024
fc4eca2
Merge branch 'devel' into CB-5185-sql-editor-queries-highlighting-is-…
sergeyteleshev Aug 21, 2024
9a03973
CB-5185 fixes incorrect highlight when typing new script
sergeyteleshev Aug 21, 2024
f002c4a
Merge branch 'devel' into CB-5185-sql-editor-queries-highlighting-is-…
sergeyteleshev Aug 21, 2024
1a193ad
CB-5185 execute correct active query
sergeyteleshev Aug 21, 2024
5497ef9
Revert "CB-5185 execute correct active query"
sergeyteleshev Aug 21, 2024
417c0cc
CB-5185 returns activeSegment for queries to execute
sergeyteleshev Aug 21, 2024
c24f436
CB-5185 does not execute query for empty query selected with cursor
sergeyteleshev Aug 21, 2024
79263d3
CB-5185 highlights queries only if cursor is in segment
sergeyteleshev Aug 21, 2024
3e25251
CB-5185 cleanup
sergeyteleshev Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@
}

.editor .active-query {
/* disable because look too ugly */
/*
display: inline-block;
@include mdc-theme-prop(background, secondary, false);
*/
}

.editor .cm-content ::selection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export abstract class BaseSqlDataSource implements ISqlDataSource {
readonly onUpdate: ISyncExecutor;
readonly onSetScript: ISyncExecutor<ISetScriptData>;
readonly onDatabaseModelUpdate: ISyncExecutor<IDatabaseDataModel<QueryDataSource>[]>;
readonly onSetCursor: ISyncExecutor<ISqlEditorCursor>;

protected outdated: boolean;
protected editing: boolean;
Expand All @@ -101,6 +102,7 @@ export abstract class BaseSqlDataSource implements ISqlDataSource {
this.onUpdate = new SyncExecutor();
this.onSetScript = new SyncExecutor();
this.onDatabaseModelUpdate = new SyncExecutor();
this.onSetCursor = new SyncExecutor();

this.onDatabaseModelUpdate.setInitialDataGetter(() => this.databaseModels);
this.onSetScript.next(this.onUpdate);
Expand Down Expand Up @@ -244,6 +246,7 @@ export abstract class BaseSqlDataSource implements ISqlDataSource {
end: Math.min(end, scriptLength),
});
this.onUpdate.execute();
this.onSetCursor.execute({ ...this.innerCursorState });
Wroud marked this conversation as resolved.
Show resolved Hide resolved
}

setEditing(state: boolean): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface ISqlDataSource extends ILoadableState {
readonly onUpdate: ISyncExecutor;
readonly onSetScript: ISyncExecutor<ISetScriptData>;
readonly onDatabaseModelUpdate: ISyncExecutor<IDatabaseDataModel<QueryDataSource>[]>;
readonly onSetCursor: ISyncExecutor<ISqlEditorCursor>;

isOpened(): boolean;
isReadonly(): boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,15 @@

untracked(() => data.init());

useExecutor({
executor: data.dataSource?.onSetCursor,
handlers: [
function handleCursorChange({ begin, end }) {

Check warning on line 510 in webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts

View check run for this annotation

Jenkins-CI-integration / CheckStyle TypeScript Report

webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts#L510

begin is defined but never used. (@typescript-eslint/no-unused-vars)

Check warning on line 510 in webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts

View check run for this annotation

Jenkins-CI-integration / CheckStyle TypeScript Report

webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts#L510

end is defined but never used. (@typescript-eslint/no-unused-vars)
data.updateParserScripts(); // TODO should we add debounce here? 2000ms? 300ms?
},
],
});

useExecutor({
executor: data.dataSource?.onSetScript,
handlers: [
Expand Down
Loading