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-4348 fix: parse sql script #2212

Merged
merged 2 commits into from
Dec 14, 2023
Merged

CB-4348 fix: parse sql script #2212

merged 2 commits into from
Dec 14, 2023

Conversation

Wroud
Copy link
Member

@Wroud Wroud commented Dec 8, 2023

No description provided.

@@ -20,6 +20,7 @@ import { useS } from './useS';
import { useStyles } from './useStyles';

interface Props {
tag?: 'button' | 'a' | 'div';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? I believe it is better to divide functionality. For example if we want a button to behave like a link it should be something like this:

<Link>
    <Button>Button Text></Button>
</Link>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to HTML, it's a really bad idea to place tags like this: <a><button></button></a>
the main idea here is that sometimes we want to display button looking component as a link or div so we can place it in another component like a button or input label

(it's really rare cases usually)

@@ -228,7 +226,7 @@ export function useSqlEditor(state: ISqlEditorTabState): ISQLEditorData {
const formatted = await this.sqlDialectInfoService.formatScript(this.dataSource.executionContext, script.query);

this.onFormat.execute([script, formatted]);
this.setQuery(query.substring(0, script.begin) + formatted + query.substring(script.end));
this.setScript(query.substring(0, script.begin) + formatted + query.substring(script.end));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes JS behaves crazy in this cases of concatenation if data is not as it expected to be. I would recommend to use .concat method to avoid bugs in future

@sergeyteleshev sergeyteleshev removed their assignment Dec 11, 2023
@Wroud Wroud merged commit 5779100 into devel Dec 14, 2023
4 checks passed
@Wroud Wroud deleted the fix/cb-4348/parse-script branch December 14, 2023 09:57
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.

3 participants