Closed DevarooGit closed 1 year ago
Due to some API technical limitations, I can't control the correct rendering of bracket highlighting, so I disabled this feature in the latest version. I'm thinking of some other countermeasures to improve the problem.
Also, I've noticed that some themes may not render editor tokens correctly. But the default Dark+ theme is ok, if it doesn't have any highlight on some popular theme, please let me know.
Righto, not surprising then that brackets don't highlight if that's been disabled! I sure hope that'll be back in future versions; at least for me, bracket highlighting is pretty much the most important feature, e.g. when writing complex templates (well, I should probably learn Lua and switch to Modules anyway :grimacing: but for now...). Anyway, I appreciate that those API limitations are currently in the way so no complains here. Re: themes, I only use the default dark theme, so no experience with others.
Another solution is to use the previous solution, adding highlighting to each parenthesis. I'm wondering if you think it's better to use a scheme like this as shown in the picture (which might make the display too fancy), or would you rather have no highlighting?
PS: Just an investigation and may not end up selecting these options.
Is this just about syntax highlighting in general, or about matching bracket pairs? Because, especially in wikitext where you can't have indention and stuff, I really need to find bracket pairs quickly in large templates.
Yes, I mean the matching of paired parentheses.
Another solution is to use the previous solution, adding highlighting to each parenthesis. I'm wondering if you think it's better to use a scheme like this as shown in the picture (which might make the display too fancy), or would you rather have no highlighting?
No, highlighting single brackets isn't helpful. The ideal solution is something like this:
This solution (1) matches double curly braces (templates) as well as triple curly braces (parameters) and (2) uses different colors if templates or paremeters are nested. Which happens to be what I get with Wikitext extension v3.6.5, running on VC 1.74.0 for macOS 10.15.7.
The problem is that such highlights will render incorrectly in many edge cases:
{{t|{{#if:|}}}}
Some people complain about wrong rendering like this.
/offtopic start
Especially in wikitext where you can't have indention
If indentation is giving you trouble, I would recommend to still write clean code in VC Code – i.e., with appropriate line breaks and indents – and then save a copy with all line breaks and indents removed for use in MediaWiki. This can easily be done in VC Code by selecting all code and pressing ctrl
+j
(on mac, don't know what the Windows hotkey is). This is incredibly useful even when you have bracket highlighting. BTW, I've found that indentation actually does work well in most cases (MW 1.38 / 1.39); but yeah, there's the odd case where it doesn't work. In those cases I would use the method described above.
/offtopic end
The problem is that such highlights will render incorrectly in many edge cases:
{{t|{{#if:|}}}}
This isn't really an edge case, it's simply a nested template where two or more closing brackets are right next to each other (i.e., without other characters between them). (In this case it's a parser function nested inside a template, but given that a parser function also has 2 curly brackets at its start and end, I assume that won't make a difference?).
Anyway, users can fix the issue that you show by adding a space between the closing brackets:
Another way to fix this is adding line breaks before parameters:
I've found that both solutions work well in most cases, i.e. they won't break wikitext functionality.
I would agree that not having to use such workaround would be even more convenient. But for me personally it's acceptable. Especially since using linebreaks is often the cleanest solution anyway (see my previous response to @shaedrich). In any case, using this very small workaround is imho preferable to not having bracket matching at all.
OK, I'll take your opinion. And try to restore this functionality in a future minor version update.
Sounds good, thanks mate! If necessary, feel free to adapt my previous response for the documentation, e.g. for a section "Known issues". Greetings and have a nice evening
G'day, thanks for this very useful extension. FYI, in v.3.7.0 bracket highlighting doesn't work at all on my machine. Nada, niente. In v.3.6.5 it works 99% fine; only issue is that highlighting of some closing brackets is delayed. I'm currently using the extension with VS Code 1.74.0 with macOS Catalina (10.15.7). If you need more information please let me know. Cheers, Lucas