Highlight custom functions in SciTE?

The popular SciTE-based AutoHotkey Script Editor
Leli196
Posts: 216
Joined: 29 Aug 2015, 05:47
Location: Germany

Highlight custom functions in SciTE?

26 Feb 2016, 08:25

Hey, I would like to know whether it is possible to highlight own/custom functions (to be precise: their names), like ScitE4AHK does with built-in functions like Round() or Sqrt(). I found nothing regarding this on the forum/the Internet.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Highlight custom functions in SciTE?

26 Feb 2016, 17:03

Create a text file named user.ahk.api in your SciTE user config directory, and list the functions there, one to a line.
Leli196
Posts: 216
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: Highlight custom functions in SciTE?

26 Feb 2016, 17:47

After doing so my functions were added to SciTE's auto-complete feature, but still have no highlighting. I found this in the meantime in an old thread: keywords3.$(file.patterns.ahk)=$(ahk.keywords3) lowercase custom function names
I cannot figure out how to use this correctly. When I exchange keywords with a function's name, it does not have an effect.


Edit:
Found out how it works, lol:
keywords3.$(file.patterns.ahk)=$(ahk.keywords3) customfunction

However, it does not work with a function that has a number as a suffix. Is there some way to fix this?
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Highlight custom functions in SciTE?

26 Feb 2016, 21:18

Right, I mustn't have been paying attention.
Leli196 wrote:However, it does not work with a function that has a number as a suffix.
What do you mean? This highlights foo42 just fine:

Code: Select all

keywords3.$(file.patterns.ahk)=$(ahk.keywords3) foo42
If you meant "any function name with a common prefix and any number as a suffix" (which seems odd), you can write ^foo, but it will also highlight any "foo" with any other (numeric or non-numeric) suffix.
Leli196
Posts: 216
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: Highlight custom functions in SciTE?

27 Feb 2016, 07:14

It was because I wrote this:

Code: Select all

(This is an example of how to do it wrong!!)
keywords3.$(file.patterns.ahk)=$(ahk.keywords3) foo
keywords3.$(file.patterns.ahk)=$(ahk.keywords3) foo2
keywords3.$(file.patterns.ahk)=$(ahk.keywords3) foo3
keywords3.$(file.patterns.ahk)=$(ahk.keywords3) bar
It only highlighted the last name "bar" because you have to write all keywords to the same line or use the following method:

Code: Select all

ahk.keywords3=\
keywords functions etc \
another keyword another function \
keywords3.$(file.patterns.ahk)=$(ahk.keywords3)
Btw, the number changes the type of highlighting; 1 is used for special variable names like A_Index, 2 for Commands like PixelGetColor and 3 for functions.
Maybe this helps somebody in the future.
User avatar
rediffusion
Posts: 58
Joined: 15 Mar 2019, 05:16

Re: Highlight custom functions in SciTE?

29 Oct 2019, 17:42

@lexikos
@Leli196

Tested right now...
For me it works if I put it here:
"C:\Users\MyPC\Documents\AutoHotkey\SciTE\SciTEUser.properties"
I also found a file that contains `keywords`. I don't understand why they're here and where they're being used?:
"C:\Program Files\AutoHotkey\SciTE\ahk.keywords.properties"
P.S. ··· @gregster
Apologize, but I'm at a dead end! So I have to write a post... ʅ_(ツ)_ʃ

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 22 guests