Highlight custom functions in SciTE?

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

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: 5598
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

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: 176
Joined: 29 Aug 2015, 05:47

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: 5598
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

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] [Download] GeSHi © Codebox Plus

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: 176
Joined: 29 Aug 2015, 05:47

Re: Highlight custom functions in SciTE?

27 Feb 2016, 07:14

It was because I wrote this:

Code: [Select all] [Download] GeSHi © Codebox Plus

(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] [Download] GeSHi © Codebox Plus

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.

Return to “SciTE4AutoHotkey”

Who is online

Users browsing this forum: No registered users and 1 guest