-
Notifications
You must be signed in to change notification settings - Fork 392
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
CB-5185 SQL Editor queries highlighting is broken #2842
Conversation
This reverts commit d801125.
webapp/packages/plugin-sql-editor/src/SqlDataSource/BaseSqlDataSource.ts
Outdated
Show resolved
Hide resolved
This reverts commit 1a193ad.
const result = await this.sqlEditorService.parseSQLQuery(projectId, connectionId, this.value, this.cursor.begin); | ||
|
||
if (result.end === 0 && result.start === 0) { | ||
return; | ||
} | ||
|
||
if (this.activeSegment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it below cause I don't want to execute the query if selected line of SQL is empty (no query)
also this.activeSegmentMode.activeSegmentMode
not really works so changed it also to this.activeSegment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert, this will affect other places, please in general don't touch code that work fine (our code related to query execution is working fine so there no need to change anything) when you have problem with different things (highlighting)
|
||
editor.clearActiveQueryHighlight(); | ||
|
||
if (!isScriptChanged) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for the case when we just move the cursor with mouse or keyboard arrows
@@ -44,13 +50,29 @@ export function useSQLCodeEditorPanel(data: ISQLEditorData, editor: IEditor) { | |||
); | |||
|
|||
const updateHighlight = useCallback( | |||
throttle(() => state.highlightActiveQuery(), 1000), | |||
debounce(() => state.highlightActiveQuery(), 300), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more performance and UX-friendly. Now with 120k rows in SQL editor I have almost no lags on my M1 PRO
const result = await this.sqlEditorService.parseSQLQuery(projectId, connectionId, this.value, this.cursor.begin); | ||
|
||
if (result.end === 0 && result.start === 0) { | ||
return; | ||
} | ||
|
||
if (this.activeSegment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert, this will affect other places, please in general don't touch code that work fine (our code related to query execution is working fine so there no need to change anything) when you have problem with different things (highlighting)
closed in favor of #2866 |
No description provided.