Open eko234 opened 2 years ago
Writing syntax highlighting for languages in Kakoune is not as tough as you might think.
You can study many syntax highlighters available for other languages in Kakoune source code to understand how to do highlighting. Start out simple -- adding highlighting for reserved keywords is usually very easy for instance. Then you can add syntax highlighting for Ada comments and slowly build support for other Ada constructs.
I doubt that this request will be fulfilled for a very long time given the purely volunteer nature of Kakoune. It would be awesome if you contributed something skeleton/basic. People can successively improve it also.
This is my quick and dirty highlighter for ADA keywords. It's not much but it's better than nothing.
Maybe someone can put together a PR and add some operators in there.
hook global BufCreate .*\.(ad[sb]) %{
set-option buffer filetype ada
}
hook global WinSetOption filetype=ada %{
require-module ada
}
hook -group ada-highlight global WinSetOption filetype=ada %{
add-highlighter window/ada ref ada
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ada }
}
provide-module ada %§
add-highlighter shared/ada regions
add-highlighter shared/ada/code default-region group
add-highlighter shared/ada/string region '"' (?<!\\)(\\\\)*" fill string
add-highlighter shared/ada/comment region '--' '$' fill comment
add-highlighter shared/ada/code/ regex '(?i)\b([a-zA-Z0-9][a-zA-Z0-9_\.]*)\b' 0:function
evaluate-commands %sh{
# Keywords
keywords="abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant"
keywords="${keywords}|declare|delay|delta|digits|do|else|elseif|end|entry|exception|exit|for"
keywords="${keywords}|function|generic|goto|if|in|interface|is|limited|loop|mod|new|not|null"
keywords="${keywords}|of|or|others|out|overriding|package|pragma|private|procedure|protected"
keywords="${keywords}|raise|range|record|rem|renames|requeue|return|reverse|select|separate"
Keywords="${keywords}|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when"
keywords="${keywords}|while|with|xor"
printf %s "
add-highlighter shared/ada/code/ regex '(?i)\b(${keywords})\b' 0:keyword
"
}
§
Feature
...
Usecase
No response