Ignore Prefix or Suffix Characters
-
Here is the in program editor. I would like the “@” and “!” to be black and the keyword to stay red.
https://i.ibb.co/MnQZWrF/uos.png -
Put the
!
before the image link, and it will embed in the post. You had it there at one point, but then edited it to just a link.![](https://i.ibb.co/MnQZWrF/uos.png)
=>I still cannot tell what you want – unfortunately, “Here is the in program editor” doesn’t parse as a full, meaningful English sentence.
Is that a picture from Notepad++, or from some other program? If it’s from some other program, what does the equivalent snippet look like in Notepad++ right now?
Can you share your UDL definition (assuming there’s nothing secret about the language)? It’s hard to help you edit your UDL definition to work as you want it, if we don’t have a starting point. To share the UDL definition : Language > Define Your Language, select your UDL from the pulldown, export; open the exported .xml file in notepad++, select all, TAB, copy; then paste into your reply here. (You could, in theory, post your xml file to a file-sharing site… but I won’t follow such a link, because there’s just too many nasty infectious files out there)
-
-
I had it inline, but it wasn’t showing up (for me) so I changed it to just the link…
Sorry, I had a typo. Should have said "Here it is in the “in-program” editor. You can see how the keywords are highlighted red, but the “@” and “!” are ignored/in black.
https://pastebin.com/gg4Cd1Gf
I pasted the UDL for you. -
Hello @aclark13, @PeterJones, @gurikbal-singh and All,
I’m not totally sure that it will work, but do these few steps, below :
-
Go to the menu option
Settings > Preferences... > Delimiter > Word character list
-
Select the second option
Add your character as part of word
-
Type in your two characters
@
and!
-
Close the dialog
From now on, any word, beginning and/or ending with
@
or a!
character is supposed to be a real word, too !Remember that the default word character set is the regex
[A-Za-z0-9_]
Just remark that if you double-click on the word
!Test@
, it will select it, entirely, as well as the word@Test!
!Best Regards,
guy038
-
-
That’s not exactly what I need. Its actually appending (?) that char to the word. I actually want to separate those chars from the words and treat them different than the word.
*Side note, saw that highlighting a word shows all uses of that word. That’s handy.
-
welcome to the notepad++ community @aclark13
yes, this is possible.
you have to set ! and @ as operators 1 (operators without separators for use as prefix and/or suffix) as seen in the screenshot below:note: i’ve set the op1 styler colour to pink+bold for visibility and testing reasons, you can leave it black or give it any colour you like
here’s another screenshot with your sample keywords.
as soon as you have set ! and @ as operators, you don’t have to include them in your keywords list, so it’s enough to write findobject, without the need of adding each prefix/suffix variants like @findobject or findobject! as an extra entry
-
That seems to have worked. Thank you @Meta-Chuh !!
I can make a new topic if its easier, but is there a way to define auto complete / tool tips for my own language?
Also is there a way to set indentations?
-
you’re welcome @aclark13
I can make a new topic if its easier, but is there a way to define auto complete / tool tips for my own language?
its fine if we stay here, it’s the same udl anyways.
yes, you can create your own autocompletion/tooltips definition manually.
first have a look at the existing autocompletion xml file libraries you could use as a template in
C:\Program Files (x86)\Notepad++\autoCompletion
(notepad++ version 7.6.2+) orC:\Program Files (x86)\Notepad++\plugins\APIs
(older versions of notepad++).open the ones you best know, for example php.xml or any other language that you might be familiar with, or that seems to have similarities with your udl.
then if you are ready to modify one of them for testing, close notepad++.
now make a copy of the autocompletion.xml you chose, eg. lua.xml or php.xml inside the same folderC:\Program Files (x86)\Notepad++\autoCompletion
(or \plugins\APIs if you use an older version of notepad++) and rename it to YourUDL.xml and play around editing it.note: YourUDL.xml has to be exactly the same name you gave your udl (case sensitive), so if you called it MyUOS you have to use MyUOS.xml for your custom autocompletion library.
one downside:
tootlips are usually triggered for functions, so they will only appear automatically as soon as you type(
bracket after a keyword, so they won’t be triggered if a keyword is not followed by a(
orspace+(
.i’ll report back if i find any workaround for that
-
Thanks I will start looking into that. Unfortunately the functions in these scripts don’t use a ( so that might not work.
-
Unfortunately the functions in these scripts don’t use a ( so that might not work.
the only (dirty) workaround i’ve been able to come up with, is to temporarily type an
(
after your function if you want to view your calltip/parameter hint or mini manual, then press backspace to remove the(
and resume with the correct syntax.your key word (target in this example) will stay black as long as you keep the bracket there, so it’s easy to spot if you forget to remove the opening bracket once in a while with this q’n’d workaround.
please keep us informed if you come up with anything more suitable for this case.
btw.: here’s a link to the (pretty old) autocompletion wiki if it helps:
http://docs.notepad-plus-plus.org/index.php/Auto_Completion