UDL Background Issue?
-
Hello all,
are UDLs just bugged, am I doing something wrong, or is my custom theme messing with it?
I cannot get any UDLs to function properly. They all come with a non transparent backgrounds for some reason, which means every word is highlighted. Clearly just completely unusable.
I can edit some of this in “define your language” but I am sill always stuck with at minimal string literals and round bracketed still having a white or black background.
I have the Dracula theme installed
I am trying to use this (https://github.com/haikubox/configs/tree/master/notepad%2B%2B). it even includes a screenshot, so it was working at some point with some np++ configuration.
The one in the official UDL repo is at least for a dark themes unusable imho, and still had the same issue.Also, am I supposed to create the plugins\APIs folder? Or has that featured changed as well? MAybe the Autocomplet folder?
-
@Jonathon-Wisnoski You need to change the styler to match the Dracula theme.
-
@supasillyass That is what I am doing to fix all the other highlighting, or more specifically just changing it to transparent to work with any theme.
But even tho “delimiter 1 style” seems to define a string literal: “” it has no effect on the highlighting of the string literals no matter what color or transparency I set.
-
More testing. These seems to be something broken with UDL. If I remove the Delimer style 1 and copy it to Del. style 4, it starts to work.
Similarly, if I do the same for Operators 1 to Operations 2 it works for everything except for last line characters/ It looks like brackets really are not operators and perhaps their is a better section for them? But that is where all the UDLs are putting them
-
@Jonathon-Wisnoski Are you using the UDL editor or directly editing the XML file?
-
@supasillyass
The UDL editor. The xml looks fine, but I am not xml or UDL expert -
@Jonathon-Wisnoski A few screenshots might help.
-
@supasillyass
This is as close I I could get it to working. Have not even tested with much code, so their might be more broken keywords.The “Operators 1”, “Delimiter 1 and 2 style” text boxes seems to be bugged, as just copying their contents over to later text boxes fixed many issues.
It looks like the remaining issue with the “{” and “)” characters is just that they are the last character on a line. Maybe that is just a limitation of Operators? Brackets are not really operators, but that is where everyone putd them, and operators should be able to work over multiple lines so I don’t know.
image url)
-
@Jonathon-Wisnoski said in UDL Background Issue?:
They all come with a non transparent backgrounds for some reason, which means every word is highlighted. Clearly just completely unusable.
UDLs are not theme-aware (that was a design-choice made decades ago, and isn’t likely to be changed, especially since its been years since any feature requests have been implimented in the UDL system).
You have to use a compatible theme, or pick different colors for your UDL than the UDL shipped with. For example, the haikubox/configs UDL for Go that you linked to has named theirs
userDefineLang-Go-Obsidian.xml
, which makes it rather obvious that it was colored to match the Obsidian theme in Notepad++.If you want to make your UDL match a different theme, you will have to change the colors in your UDL to match that theme. (So if “Dracula” uses a different background color than “Obsidian”, you will have to change your background colors on all the styles in your UDL to match the Dracula background… and you may also have to change some foreground colors in case there’s conflict.)
The “Operators 1”, “Delimiter 1 and 2 style” text boxes seems to be bugged, as just copying their contents over to later text boxes fixed many issues.
Nope, they work just fine. It could be possible that you had conflicting definitions for the same characters in multiple places.
It looks like the remaining issue with the “{” and “)” characters is just that they are the last character on a line.
Nope, they work just fine as the last character of a line as well. In the screenshot you are showing, your caret is on one of the matched-pair, so it’s highlighted as “brace highlight style”, which is what Notepad++ uses for showing you
()
and{}
and[]
pairs; if your caret were elsewhere, it would be showing in your operator style.Brackets are not really operators, but that is where everyone putd them,
Not everyone. Many times, brackets, braces, and parentheses are used as delimiter pairs rather than operators. But it’s fine to have them as operators. If you put them in “Operators 2”, they require a space or newline before and after them (which explains why the
(
afterPrintln
isn’t colored – because you don’t have the space, but are using “operators 2”).and operators should be able to work over multiple lines so I don’t know.
They do.
I am trying to use this (https://github.com/haikubox/configs/tree/master/notepad%2B%2B ).
The instructions given there are years out of date. Each UDL should go in its own xml file in the
%AppData%\Notepad++\userDefineLangs\
directory or<install_directory>\userDefineLangs\
directory, as described in the user manual on UDL.And if you want autoCompletion for the same language, the file goes in the
<install_directory>\autoCompletion\
directory.However, when I used the definition from the haikubox/configs that you linked to, and had my N++ in Dark Mode with Obsidian theme and the language of my new file set to “Go” from the UDL section, with text similar to yours, I see it highlighting correctly – even with “Operators 1” and “Delimiters 1 and 2” like you said didn’t work:
If you’re having trouble seeing the operators, it’s because they picked a color that was very similar to the default font color for Obsidian and this UDL. If I (temporarily) use a red background for the operator styling, it’s obvious that it’s correctly syntax highlighting them.
-
@Jonathon-Wisnoski Contrary to the README, just copy
userDefineLang-Go-Obsidian.xml
to the%APPDATA%\Notepad++\userDefineLangs
folder (ignore “Copy go.xml into your plugins\APIs directory”). And it’s probably best not to edituserDefineLang.xml
directly with Notepad++. -
Thanks PeterJones for looking at my problem
colored to match the Obsidian theme in Notepad++.
Yes, i tried Obsidian, but the background is black so it did not work any better.
Nope, they work just fine as the last character of a line as well. In the screenshot you are showing, your caret is on one of the matched-pair, so it’s highlighted as “brace highlight style”, which is what Notepad++ uses for showing you () and {} and [] pairs; if your caret were elsewhere, it would be showing in your operator style.
No, I can guarantee you that it has nothing to do with cursor location as it does not change when I move my cursor.
if you put them in “Operators 2”, they require a space or newline before and after them (which explains why the ( after Println isn’t colored – because you don’t have the space, but are using “operators 2”).
Yes, I read that and make sure to put spaces. it fixed nothing.
The instructions given there are years out of date.
Yes, but I have tried all the UDL, in and out of the official repo using every method for importing mentiond anywhere and everywhere. Maybe my installation is just bugged. I see you got yours working.
-
Hmm, yes it seemed to be some sort of corruption.
I went and did a clean sweep, like the third of fourth time, but this time it worked and the theme loaded in almost perfect and just needed some transparency and case insensitivity to get probably as good as it is going to get.Their seems to be 3 locations to delete themes from userDefineLang.xml, userDefineLang folder, and the gui style editor. I deleted all these before, and restarted dozens of times. But for some reason it never worked until now.
-
@Jonathon-Wisnoski said in UDL Background Issue?:
I deleted all these before, and restarted dozens of times. But for some reason it never worked until now.
Order of operations is significant. If Notepad++ was still open when you deleted it from the
userDefineLang.xml
, then when Notepad++ exited, it re-saveduserDefineLang.xml
when Notepad++ exited, thus undoing your supposed edit. Editing Notepad++ config files from inside Notepad++ requires following the specific sequence in the User Manual.