notepad-plus-plus icon indicating copy to clipboard operation
notepad-plus-plus copied to clipboard

Cannot add new keywords in Lua

Open PavelBlend opened this issue 5 years ago • 6 comments

I am working with an application that adds functions to the Lua core library. I need to highlight these functions in a different color. I am editing the langs.xml file, but Notepad ignores the new keywords. How do I add syntax highlighting for new keywords in lua?

PavelBlend avatar Nov 18 '19 20:11 PavelBlend

@PavelBlend This is a great question to ask on the Community ( https://community.notepad-plus-plus.org/ ) rather than here as an issue. But, to answer the question, I'd suggest doing what you need here:

image

If what you are adding are truly "keywords", maybe the INSTRUCTION WORD section is also appropriate.

sasumner avatar Nov 18 '19 21:11 sasumner

I need the color of the new keywords to be different from the color of the standard functions. To do this, I created a new tag in the langs.xml file named type3. And created a new style in the stylers.xml file. But notepad ignores him.

PavelBlend avatar Nov 19 '19 07:11 PavelBlend

The reason you can't add your own group of words to the lua lexer is that npp restricts the number of possible groups to be four and those are already in use. Lua lexer itself would be able to handle up to 8 different groups.

Ekopalypse avatar Nov 19 '19 12:11 Ekopalypse

And can this restriction be removed so that it is not in the next version of Notepad?

PavelBlend avatar Nov 19 '19 12:11 PavelBlend

In theory, yes and there was already some similar discussion here, but there was no outcome, so I assume this kind of feature request is not that attractive. :-(

Ekopalypse avatar Nov 19 '19 12:11 Ekopalypse

@PavelBlend Do you still need more keywords list? If yes then how many? Lua support 8 keywords list, actually we use only 4. If necessary we can add more. https://github.com/ScintillaOrg/lexilla/blob/master/lexers/LexLua.cxx#L50 https://github.com/ScintillaOrg/lexilla/blob/master/lexers/LexLua.cxx#L446

ArkadiuszMichalski avatar Nov 10 '22 01:11 ArkadiuszMichalski

@ArkadiuszMichalski I apologize for the long absence.

I would like to have as many keywords list as possible. That is, it is desirable to have 8 keywords list.

PavelBlend avatar Dec 01 '23 08:12 PavelBlend