New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua syntax highlighting changes #2485
Conversation
Add goto to the basic functions Remove math and os fields; for example, still highlight math.sin but not sin because sin is not defined by default. I did not remove fields which are methods, so for example read is still highlighted so that it's also shown in myfile:read()
Needs a Luaist to comment. |
Excellent, I was about to report an issue, I hope this solves |
hmm... yes, the correct syntax highlight that Lua needs in Geany |
To everybody commenting, why don't you try it and let us know if its an improvement or has major (new) bugs? Geany devs can't be experts on all languages, they rely on community members to test stuff they don't use themselves. But so far @HybridDog has been left hanging because nobody will test this. |
In the first, we needs to define a minimum Lua version. Maybe 5.1+? Because:
it's not true too: see Lua 4.x.x documentation. Why did I think and write about Lua 4.x.x? It's simple: I see P.S. |
Thanks for the information. I have never used Lua 4. In my opinion it is better to not highlight keywords which exist only in an old version, e.g. version 4.x.x. |
@HybridDog to have different versions of highlighting you would have to have two different filetypes. But do Lua source files specify which version of Lua they use, by some marker in the file? by file extension? If not how would the specific filetype be chosen when a file is opened? Most other languages highlight all keywords of all versions, but many of them only add keywords not remove keywords, Lua would be unusual in removing them. The same goes for built-in functions that won't be found by tags. |
The lua version is not included in the script. (An exception is a file with a shebang, but such a file is uncommon and can only be executed directly and not included with dofile.)
I assume that for consistency it should also highlight old keywords and my changes are too simple. |
I didn't like how geany highlights things in lua code which are undefined unless the user defines them:
I have removed some keywords which are undefined in Lua 5.1+. It's a simple change, so
type
in the above example and other things are still highlighted even when they shouldn't.Add goto to the basic functions
Remove math and os fields; for example, still highlight math.sin but not sin because sin is not defined by default.
I did not remove fields which are methods, so for example read is still highlighted so that it is shown in myfile:read()
Edit: mention Lua 5.1+