Hi,
How could I get a list of keywords used by current language of an opened document ?
I wish to test if a given word is in the list of keywords.
I found "editor.describeKeyWordSets()"
It returns only 'Keywords\nOperators\nAttributes\nStandard Functions\nStandard Packages\nStandard Types\nUser Words'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately there's no way to ask scintilla for the keyword list. You could look it up in langs.xml though - it's not perfect as if it's just been changed (and N++ has not been restarted), then langs.xml won't reflect the real state of the keywords.
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a way to know when Scintilla found a keyword (in NPP)?
I mean, I want to know when I click a reserved keyword, that Scintilla used it from the list (for a plugin I'm writing for NPP).
Thx.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sadly that's a bit of a mess in scintilla as far as I know. You can look at
the style of the clicked word, which gives you a single byte number. This
number corresponds to some identified content, e.g. some "language
element". These styles are different across the different lexers, e.g.
style 1 might be a keyword in the C++ lexer, but might be a method in the
JavaScript lexer.
Basically, you'd need a map of lexer to keyword style, which you can get by
looking at the lexer information - I think there's a file somewhere with
the style names for each lexer, even though it might not be complete. Ask
on the scintilla mailing list if you can't find the info you need.
Is there a way to know when Scintilla found a keyword (in NPP)?
I mean, I want to know when I click a reserved keyword, that Scintilla
used it from the list (for a plugin I'm writing for NPP).
Thx.
Hi,
How could I get a list of keywords used by current language of an opened document ?
I wish to test if a given word is in the list of keywords.
I found "editor.describeKeyWordSets()"
It returns only 'Keywords\nOperators\nAttributes\nStandard Functions\nStandard Packages\nStandard Types\nUser Words'
Unfortunately there's no way to ask scintilla for the keyword list. You could look it up in langs.xml though - it's not perfect as if it's just been changed (and N++ has not been restarted), then langs.xml won't reflect the real state of the keywords.
Dave
Thanks for answer. I have copied/pasted those keywords in my script.
Is there a way to know when Scintilla found a keyword (in NPP)?
I mean, I want to know when I click a reserved keyword, that Scintilla used it from the list (for a plugin I'm writing for NPP).
Thx.
Sadly that's a bit of a mess in scintilla as far as I know. You can look at
the style of the clicked word, which gives you a single byte number. This
number corresponds to some identified content, e.g. some "language
element". These styles are different across the different lexers, e.g.
style 1 might be a keyword in the C++ lexer, but might be a method in the
JavaScript lexer.
Basically, you'd need a map of lexer to keyword style, which you can get by
looking at the lexer information - I think there's a file somewhere with
the style names for each lexer, even though it might not be complete. Ask
on the scintilla mailing list if you can't find the info you need.
On Thu, 17 Dec 2015 08:11 roymesi roymesi2@users.sf.net wrote: