I'd like to suggest adding explicit delimiters between interface/world items. For example, this could be semicolons:
interface example {
a: func();
b: func() -> ();
c: func() -> t;
type t = u32;
}
Reasoning:
I was experimenting with textmate grammars for WIT (tmLanguage is used by vscode) and discovered that it's difficult to add full-featured syntax highlighting because of tm limitations. In order to add "scope" to some part of the document, tm has to know exactly where it starts and ends. This works for interfaces (they start with { and end with }), however it causes problems with interface children. For example, functions can span multiple lines (so we can't use \n as end), they can have return type missing or specified without parenthesis (so we can't use ')').
Proto format uses semicolons for this.
There are workarounds: for instance it's possible to ignore meta and other conventional scopes and highlight keywords only instead. However, this will make writing wit files uncomfortable :(
VS Code supports "semantic tokens" which provides better highlighting for lsp-enabled languages. However, it's difficult to say if this is enough without actually implementing both tm and lsp
I'd like to suggest adding explicit delimiters between interface/world items. For example, this could be semicolons:
Reasoning:
I was experimenting with textmate grammars for WIT (tmLanguage is used by vscode) and discovered that it's difficult to add full-featured syntax highlighting because of tm limitations. In order to add "scope" to some part of the document, tm has to know exactly where it starts and ends. This works for interfaces (they start with
{and end with}), however it causes problems with interface children. For example, functions can span multiple lines (so we can't use\nas end), they can have return type missing or specified without parenthesis (so we can't use ')').Proto format uses semicolons for this.
There are workarounds: for instance it's possible to ignore
metaand other conventional scopes and highlight keywords only instead. However, this will make writing wit files uncomfortable :(VS Code supports "semantic tokens" which provides better highlighting for lsp-enabled languages. However, it's difficult to say if this is enough without actually implementing both tm and lsp