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

Conversation

sergeyteleshev
Copy link
Contributor

No description provided.

const result = await this.sqlEditorService.parseSQLQuery(projectId, connectionId, this.value, this.cursor.begin);

if (result.end === 0 && result.start === 0) {
return;
}

if (this.activeSegment) {
Copy link
Contributor Author

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

Copy link
Member

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) {
Copy link
Contributor Author

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),
Copy link
Contributor Author

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) {
Copy link
Member

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)

@Wroud
Copy link
Member

Wroud commented Aug 22, 2024

closed in favor of #2866

@Wroud Wroud closed this Aug 22, 2024
@serge-rider serge-rider deleted the CB-5185-sql-editor-queries-highlighting-is-broken branch August 29, 2024 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants