Autohotkey Indent Folding?

Syntax highlighting, code folding, brace matching, code indenting, and function list

Autohotkey Indent Folding?

Postby stretch65 » Fri May 24, 2013 4:15 am

Hi,

Autohotkey is a fairly irregular language, and most of the syntax highlighting files I've tried don't work very well for it. It doesn't really bother me if any part of this language is highlighted. In fact I don't mind if it looks just like plain text, but what I would like most of all is for indent folding to work. Now I've tried to keep things very simple, since I'm just a noob at syntax highlighting. So far, I've tried this one line syntax file:

Code: Select all
/L1"Autohotkey" EnableCFByIndent File Extensions = ahk


The trouble with this is that in Autohotkey, there are keywords like "#If", "#IfWinActive", "#LTrim", etc. which, as you can see, start with "#". For some reason, these kinds of keywords won't trigger any indent folding. So, for example:

Code: Select all
#if winActive(App.ultraEdit)
    stuff stuff stuff
    more stuff stuff
    more stuff stuff


The above code is NOT folded at the "#if". What can I do to solve this problem?
stretch65
Newbie
 
Posts: 1
Joined: Fri May 24, 2013 3:51 am

Re: Autohotkey Indent Folding?

Postby Mofi » Fri May 24, 2013 8:31 am

On page Extra Downloads there are two user contributed syntax highlighting wordfiles for AutoHotkey named AutoHotkey and AutoHotkey Case. Perhaps you try them first before creating your own.

Both use

/Open Fold Strings = "{"
/Close Fold Strings = "}"


and do not use EnableCFByIndent. I don't know if that is good for folding as I'm not familiar with AutoHotkey syntax.

What every wordfile should contain is the line starting with /Delimiters = which defines the word delimiting characters.

However, I played with your definition and your example and it looks like it is hard-coded in UltraEdit that lines on which first character non white-space character (not a space or tab) is # are ignored for folding.

EnableCFByIndent was introduced mainly for Python. Perhaps in Python syntax lines starting with # must be ignored for code folding and the developers apply that rule for all files folding by indentation level.

In my point of view if such a hard coded rule exists as it looks like, it should be applied only to files highlighted by a wordfile containing special language marker string PYTHON_LANG or have a Python shebang at top or have a Python file extension.

So I suggest to report this issue to IDM support by email and ask for clarification if usage of EnableCFByIndent in the wordfile results automatically in ignoring all lines starting with # for folding even if the file is not a Python file.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Syntax Highlighting