-
Notifications
You must be signed in to change notification settings - Fork 40
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
Highlighting breaks with 16384 characters on the same line #513
Comments
This might be an issue with the regular expression matching from the syntax definition engine. Removing the first block comment results in the first line not being highlighted at all, but when you remove a few characters from the line (14 to be precise) the line is suddenly highlighted. Highlighting breaks at a line length of 16384 (=2^14) characters. This is the same for SASS and likely any other syntax as well, but I don't have a PHP/Python/C sample at hand. I suspect this is some kind of optimization code to not make ST load too long for lots of code on a single line because the syntax definition system works on a line basis and requires to re-parse the entire file on each modification if everything is in a single line. |
|
I reproduce the problem for HTML and CSS syntax, if I use Data URI scheme instead of images. (I use Base64 Fold package for Data URI scheme folding) Thanks. |
@Kristinita Note that there is no need to have such long lines for this use case because:
(From https://en.wikipedia.org/wiki/Data_URI_scheme#Syntax) Example:
|
Thanks. |
@Kristinita sounds like those plugins need to be fixed/enhanced then ;) |
@keith-hall, maybe you add feature requests for these packages?
Thanks.
…On 2/21/2017 12:38 PM, Keith Hall wrote:
@Kristinita <https://github.com/Kristinita> sounds like those plugins
need to be fixed/enhanced then ;)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#513 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQctveJlvCPdJNpExCDn7y6HwyexcIazks5rerCEgaJpZM4CsaGc>.
|
I do have some XML files that have really long "data" attributes. Is there any way this limit can be customized? |
Not at the moment. |
I would like to add that for some programming languages, lines can't be broken up for readability that easily, for example minecraft commands (yes this is a recognized language even by github). These commands are 1 line each. With custom items through give commands (such as books) the 16384 character limit is easily exceeded. Another more common use would of course be minified json, css, etc. files for web applications. Of course one can beautify those pieces of code and edit them, then re-minify them. (or have separate minified versions to circumvent this problem altogether) This 16384 limit seems a bit low to me, however I am not sure how this is internally determined and if at all this could be increased somewhat easily to about 512K or maybe 1M. In any case, increasing the limit would make the likelihood that you run into this bug much smaller. Only ridiculous pieces of code that have more than 1MB on a single line (excluding minified versions, as beautified versions can easily be kept aside) -that is it is a requirement- would be hit, in which case you'd probably not be working in that file manually anyways. However, for a proper fix, I suggest some way of introducing virtual new lines. They would allow the regex to remain within the 16K limit, but they won't show up, nor match, however I am not sure how viable this is to implement. |
If I open the test .css file in Windows (fresh ST3 x64 Build 3065), long lines that start with a comment are interpreted as a comment at a whole:
The syntax highlighter should either correctly highlight the CSS on long lines as well, or treat it as regular text (white). If I inserted a linebreak before the CSS definition (after the "*/"), the code is not highlighted anyway, but displayed as regular text.
Testfile:
The text was updated successfully, but these errors were encountered: