[Geany] lua filetype: highlight func def name

spir denis.spir at xxxxx
Sat Nov 28 12:16:42 UTC 2009


Enrico Tröger <enrico.troeger at uvena.de> wrote:

Thanks for the reply.

> On Thu, 12 Nov 2009 10:29:36 +0100, spir wrote:
> 
> >hello,
> >
> >cannot find how to highlight a func name in a func definition. (There
> >is no attribute in standard filetype.lua -- function_basic and
> >function_other are for builtin or stdlib func names). Tried to
> >specifiy "functionname", "funcname", defname", but none worked.
> >
> >I know there is an issue because in lua a func can be defined either
> >    function funcname(args) block end
> >or
> >    funcname = function(args) block end
> >The second form may be problematic, but the first one is the same as
> >in other common scripting languages. Would it be possible to add this
> >attribute? I guess the pattern could be the same as for python, only
> >replacing "def" by "function".
> >
> >Also, it would be nice to have a style attribute for multilne strings
> >and multiline comments. (And I don't understand the difference between
> >"string" and "literalstring" attributes.)
> 
> I don't know Lua very well at all but if I understand you correctly,
> you might want to adjust the "identifier" style. This is the style
> which is used for function names. However, this would also affect other
> identifiers like variable names and such.
> If that's not enough, you should file a feature request at the
> Scintilla project to add another style to the Lua lexer for
> highlighting function names.

Well, I'll try to find information about scintilla's Lua highlighting definition. (a pointer would be welcome)

The "identifier" is not a solution for my needs, as the point is precisely to highlight func names in func defs, as opposed to other identifiers. Actually, I'm rather surprised there is no setting for function names (in scintilla), because it's very basic and useful, indeed, and also the pattern for Lua's 1st form above is identical to the one used in many other languages. (The second form seems also rarer in common Lua code, but necessary for anonymous funcs.)

So, a follow-up question is: do geany's standard filetypes.* file show all possible settings (inherited from scintilla)? If yes, then I will for sure file a feature request for scintilla.

> >A little issue: when editing filetypes files themselves, they are
> >highlighted like source files because of their extension (eg
> >filetype.lua) --which is a bit disturbing ;-). Maybe a better scheme
> >could be to name these config files langname.cfg (eg lua.cfg). For
> >upgrading, the only thing to do is renaming filetype.x to x.cfg. Can
> >be automatic.
> 
> I think this is a very minor issue. If you know you are editing
> filetype definition files, you could set the filetype manually to
> Config file in the file open dialog or afterwards using the
> Document->Set filetype menu.
> Changing the filenames and renaming them automatically on upgrade might
> cause more problems and confusing than it would help.

Right, no problem.
 
> Regards,
> Enrico
> 


Denis
________________________________

la vita e estrany

http://spir.wikidot.com/




More information about the Users mailing list