Closed dmaluka closed 3 months ago
Damn, it was me (again) with #3090.
We've different approaches to solve this (by accessing the *.FileType
):
config.RTSyntax
files
config.RTSyntaxHeader
files
UpdateRules()
into a list, which can be accessed later on easily via the buffer
The last one seems to be the most obvious to me.
There is also another approach, which would prefer the most, if we lived in an ideal world: align all .yaml filenames with their filetype
values, so we can match just by .yaml filenames. Even better, throw out those filetype
directives as redundant. Keep It Simple, Stupid.
But due to backward compatibility reasons etc we probably don't want to do that.
So, since we need to match by *.FileType
, I think the obvious easy solution is: search and parse built-in filetypes by config.RTSyntaxHeader
files (as we already have them) and user's custom filetypes by config.RTSyntax
. Anything else sounds like a premature optimization at this point, IMHO.
But due to backward compatibility reasons etc we probably don't want to do that.
Yep, unfortunately we (I more than you) broke more than necessary. But yes, KISS fully hit it.
I think the obvious easy solution is: search and parse built-in filetypes by config.RTSyntaxHeader files (as we already have them) and user's custom filetypes by config.RTSyntax.
Ok, then we go with the more expensive approach and sacrifice a few more CPU cycles by parsing again. I will prepare something to solve my premature first shot.
When typing
set filetype
and pressing Tab to autocomplete, some of the suggested filetypes are incorrect (there is no syntax highlighting for them). For example,sh
is suggested, but the actual filetype for shell scripts isshell
, notsh
. So the user executesset filetype sh
, and as a result, the syntax is not highlighted at all.The reason is that the autocompleter simply returns the basenames of syntax
*.yaml
files, but some of those file names don't matchfiletype
values inside those files. Here is the complete list of such non-matching filetypes:Commit hash: c2c2b2ad OS: any Terminal: any