Closed pintassilgo closed 6 months ago
we call them 'staples'. so try to play with:
missing lines for []
and for column 1 - to fix.
Opt value 0,40,0,0
gives almost what you want! except missing line for []
.
Yes, thanks, fixed except by missing line for []
. I suggest you to set this as default value, as you can see this is the default for other popular editors.
when I changed the option to 0,40,0,0
, Python shows this: not nice.
what is ST/VSCode showing?
cuda_hilite py
Sublime:
VSCode:
OK, now with the same file as you:
VSCode:
Sublime:
So Cuda needs a fix.
Todo.
Seems that the only missing thing here, after changing defaults to 0,40,0,0
, is to add +1 bottom line for Python-like languages.
Change made:
Get new beta, and fixed lexer: https://github.com/Alexey-T/CudaText/blob/master/app/data/lexlib/JavaScript.lcf
Thanks. Not entirely fixed yet:
VSCode is fine:
fixed, download the JS lex again.
By the way, looking at these screenshots, code color scheme of VSCode looks better, using different colors for each hierarchy level of block (root is yellow, level 2 is pink, level 3 is blue; then 4 is yellow again, 5 pink, blue... so 3 different colors).
Other difference is the most of the code in Cuda has no color, while in VSCode objects and arrays are blue, methods/function names are yellow...
Is there any way to achieve similar results in Cuda?
using different colors for each hierarchy level of block (root is yellow, l
Should be made by custom plugin (API ed.attr()
)
the most of the code in Cuda has no color, while in VSCode objects and arrays are blue
Can be changed by editing JS lexer in lexer editor. but it will make lexer SLOWER.
Thanks. Still some missing staples:
VSCode:
fixed, redownload lexer.
Fixed one of the missing staples, not the other one:
Also this one down the if
:
fixed, redownload lexer.
Also this one down the if:
this must not be fixed, no block brackets {}
. sorry.
Thanks.
this must not be fixed, no block brackets {}. sorry.
Do you mean you think it's correct the way it is? Every other editor have the staples.
Sublime:
Kate:
Do you mean you think it's correct the way it is? Every other editor have the staples.
cannot do this , maybe even with hard work. that block dont have explicit start + explicit end.
OK, I think it's reasonable. But how about this:
VSCode:
Sublime:
Kate:
this cannot be solved - until someone edits the JS lexer and makes tick-strings (ok name?) parsed by SUBLEXER. then sublexer can add folding. but it is bad - what rules must that sublexer have? JS like? HTML like? SQL like? Rust like? syntax can be any there.
By the way, look how every other editor understand that ${}
within a `` string is JS code so it has different color compared to the rest of the string. Can I open an issue asking for such lexer improvements?
By the way, look how every other editor understand that
${}
within a `` string is JS code so it has different color compared to the rest of the string. Can I open an issue asking for such lexer improvements?
no please, instead try to use the special plugin here: Highlight Variables. it is special for this case.
this cannot be solved - until someone edits the JS lexer and makes tick-strings (ok name?) parsed by SUBLEXER. then sublexer can add folding. but it is bad - what rules must that sublexer have? JS like? HTML like? SQL like? Rust like? syntax can be any there.
The staples are shown for all the three editors even in a new document without any lexer defined (plain text).
The suggestion is to create staples based on indentation levels, maybe under option (but as I said it's default on every other popular editor).
Plain text Kate:
Plain text Sublime:
Plain text VSCode:
The staples are shown for all the three editors even in a new document without any lexer defined (plain text).
The suggestion is to create staples based on indentation levels, maybe under option (but as I said it's default on almost every other popular editor).
Cud don't have this feature- folding based on indent level W/O LEXER. all folding is from lexers. for text files - we have lexer 'Text with indentation'.
I tried Text with indentation
but it only creates folding sections, not staples.
When this gets fixed, Text with indentation
is probably your answer for this question about what to use within a string:
what rules must that sublexer have? JS like? HTML like? SQL like? Rust like? syntax can be any there.
And how to make Text with indentation
default to replace (none)
?
Text with indentation
is updated in addons - in 3 mins you can see it's updated, it has staples now
And how to make
Text with indentation
default to replace(none)
?
option "newdoc_lexer"?
it has staples now
Thanks.
option "newdoc_lexer"?
Yes, thanks.
When this gets fixed, Text with indentation is probably your answer for this question about what to use within a string: what rules must that sublexer have? JS like? HTML like? SQL like? Rust like? syntax can be any there.
lexer dependancy in JS to 'Text with indentation' will be bad - most ppl won't get the sublexer and won't have idea that such sublexer is supported
Or add Text with indentation
logic in JS lexer to work inside template literals (multiline strings in JS). The only specificity it has is that ${}
is the way to concatenate code result inside the string. So `Hi, ${name}, how are you?` is the same as "Hi, " + name + ", how are you?"
. Other than that, the multiline string should be treated as simple text with indentation.
You decide, of course, but I shown that's how other popular editors work.
I don't like the idea to add dependency to 'text with ind' lexer to JS lexer. You can clone the JS lexer and edit it in lexer editor. name it like 'JavaScript_' so it will appear next to usual lexer..
Cuda:
Sublime:
VSCode:
As you can see, Cuda is missing indentation guides for col 1 and also for col 3 when within an array block.
Extra: how to make indentation guides only mark child lines? Compare Cuda with others. In others, lines opening or closing the block aren't marked with indentation guide and it looks better this way, but in Cuda they are marked .