EnlighterJS / Plugin.WordPress

:package: Official WordPress Plugin of EnlighterJS
http://wordpress.org/plugins/enlighter/
GNU General Public License v2.0
115 stars 18 forks source link

v4.0 -- SQL highlighter issues #244

Closed petr-hybler closed 4 years ago

petr-hybler commented 4 years ago

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 ....

AndiDittrich commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

petr-hybler commented 4 years ago

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 commented 4 years ago

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

AndiDittrich commented 4 years ago

btw. the old language support file: https://github.com/EnlighterJS/EnlighterJS/blob/v2-legacy/Source/Language/Sql.js

AndiDittrich commented 4 years ago

without function call regex: image

petr-hybler commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

AndiDittrich commented 4 years ago

the changes have been applied to EnlighterJS v3.2.0