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

v4.0 -- SQL highlighter issues #244

Closed
petr-hybler opened this issue Apr 17, 2020 · 13 comments
Closed

v4.0 -- SQL highlighter issues #244

petr-hybler opened this issue Apr 17, 2020 · 13 comments

Comments

@petr-hybler
Copy link

hello the single line comments are not working properly ... when there is a single quote it treats it as a string even tho it's just a comment

example:
-- some data and ' this is treated as a string ....

  • some words are weirdly highligheted randomly (data types, function names, ..)
@AndiDittrich
Copy link
Member

Hi @petr-hybler

thanks for your report, i've moved your issue yesterday to the EnlighterJS library repository - it has been fixed asap in v4.1.0 (EnlighterJS v3.2.0).

if it doesn't work in your case please provide a full code snipped to reproduce the error

Example
image

@petr-hybler
Copy link
Author

the single line comment with quotes issue is fixed .. thx .. but the syntax is still weirdly highlighted :-/

check out the examples
Screenshot from 2020-04-17 23-00-58
Screenshot from 2020-04-17 23-02-36
Screenshot from 2020-04-17 23-02-51
Screenshot from 2020-04-17 23-03-15

@AndiDittrich
Copy link
Member

hmm.. it looks like expected...

figure 1: "desc" is a keyword, therefore the other highlighting appears
figure 2/3: keywords and "function calls" are mixed...thats not an optimal solution

the general problem with "sql" is that it has normally be split into multiple dialects to cover all use cases (i'm primarily working/testing with mariadb/mysql syntax).

@AndiDittrich
Copy link
Member

AndiDittrich commented Apr 17, 2020

the currently used language rules can be found here: https://github.com/EnlighterJS/EnlighterJS/blob/master/src/lang/sql.js

@petr-hybler
Copy link
Author

figure 1: desc is ok .. but how about the NOT NULL ? or highlighted name of the table? same like VARCHAR2 in the next figures ... it's not bold and sometimes highlighted :(

@AndiDittrich
Copy link
Member

there rule _language_common_rules.fCalls is actually used to cover something like TYPE(.. - maybe we should remove them

@AndiDittrich
Copy link
Member

@AndiDittrich
Copy link
Member

without function call regex:
image

@petr-hybler
Copy link
Author

that looks way better imo :) thx ...

btw is there still the option to set a default language as it was previously? or not anymore?

@AndiDittrich
Copy link
Member

it has been added as "fallback language" option in v4.1 (Enlighter -> Options -> Advanced -> EnlighterJS). but this setting is normally not needed because the shortcodes/markdown/gutenberg/tinymce are setting the language attribute explicitly - whats your intention to use it ?

in the previous versions there were a lot of misunderstandings by the users who didn't know what this setting really does.

@petr-hybler
Copy link
Author

all my codes are SQL only :) so it would be nice to have this language "by default" and not to pick it everytime manually (am posting a lot of articles) - that's kinda bother ... not a big deal tho

@AndiDittrich
Copy link
Member

that's the issue ;) the "default" setting doesn't set any language select boxes even in the legacy versions

@AndiDittrich
Copy link
Member

the changes have been applied to EnlighterJS v3.2.0

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

No branches or pull requests

2 participants