Currently, *.conf files uses the Properties language, like *.ini files.
But Minetest config files aren't INI files and work sightly differently (comments, line breaks, sections, etc), so we need to register a different language for these files. For mod.conf, etc the set of supported properties is specific to each files, plus minetest.conf files can be named differently. But only depending on file names for which properties to complete is still quite annoying, since in VSCode, text documents may not have a file name yet (unsaved new file). Having a language for each conf file would solve the problem, but require many duplicated stuff.
vscode.languages.registerCompletionItemProvider require a selector, which can be a language combined with a file name pattern, but it would require registering multiple ones per file. Or we check if the file name is mod.conf, etc and autocomplete with the minetest.conf entries but thats quite an ugly hack and doesn't support new unsaved files.
I have absolutely no idea yet how to create a TMLanguage definition, and we also need a parser for these files, for linting.
Since mod.conf, etc files have the same structure as minetest.conf, we can create a settingtypes.txt file for each of them and parse them to get the completion and linting (we already need a settingtypes parser for completion/linting of these files).
I did some research:
Currently,
*.conf
files uses theProperties
language, like*.ini
files.But Minetest config files aren't INI files and work sightly differently (comments, line breaks, sections, etc), so we need to register a different language for these files. For
mod.conf
, etc the set of supported properties is specific to each files, plusminetest.conf
files can be named differently. But only depending on file names for which properties to complete is still quite annoying, since in VSCode, text documents may not have a file name yet (unsaved new file). Having a language for each conf file would solve the problem, but require many duplicated stuff.vscode.languages.registerCompletionItemProvider
require a selector, which can be a language combined with a file name pattern, but it would require registering multiple ones per file. Or we check if the file name ismod.conf
, etc and autocomplete with theminetest.conf
entries but thats quite an ugly hack and doesn't support new unsaved files.https://github.com/microsoft/vscode-extension-samples/blob/ca68ab8a9cc23a6bfbbe4314f62c8e272b737251/completions-sample/src/extension.ts#L9-L49
I have absolutely no idea yet how to create a TMLanguage definition, and we also need a parser for these files, for linting.
Since
mod.conf
, etc files have the same structure asminetest.conf
, we can create asettingtypes.txt
file for each of them and parse them to get the completion and linting (we already need a settingtypes parser for completion/linting of these files).@GreenXenith Thoughts?