-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
RFC: Semantic Highlighting #6
Comments
Do we have a proper language server in |
@lukepighetti From what I understand, here is what features Semantic Tokens allow. const tokenTypesLegend = [
'comment', 'string', 'keyword', 'number', 'regexp', 'operator', 'namespace',
'type', 'struct', 'class', 'interface', 'enum', 'typeParameter', 'function',
'member', 'macro', 'variable', 'parameter', 'property', 'label'
]; We could configure the existing Mint language server to tell VS Code what each token means, and it will take care of the highlighting, this is much simpler and more maintainable over writing tmLanaguage regex's. Another example: /* This Is Comment In Mint */ The language server will tell VS Code that on line |
This also fixes the issues we currently have where the render function could be defined multiple ways: fun render {}
fun render: Html {}
fun render {
if (clicked) {
"I have been clicked!"
}
} We currently only support highlighting for |
Can you point me towards any documentation or source that will help me understand what is currently available from the Mint language server? I was under the impression that there is no language server available to us yet. |
We do not have any documentation, but the existing work is being done the language-server branch |
@lukepighetti You probably already know about this, but I realized a simple way to views changes specific to the language server, using GitHub compare feature: https://github.com/mint-lang/mint/compare/language-server |
Shall we create a branch to start implementing these hover features? It looks like it's about halfway done. Whats the recommended way to run a development version of |
It would probably be easier if a binary was built from the |
I'll have to claim ignorance on the best practices there, do you have any examples or docs I can refer to so I can educate myself further? Alternative: what if we ask @gdotdesign to put the lang server in the production build as a technical preview? |
If it's about compiling Mint just follow the steps in the contribution guide: https://github.com/mint-lang/mint/blob/master/CONTRIBUTING.md#development , to have the language server just compile it on the |
Also it might be more productive to do this in a chat format 🙂 We are on Discord and Gitter 😉 |
Building from scratch requires the user to have Crystal installed, with all the necessary packages that Crystal requires, this creates an unnecessary barrier. But we could still continue this path for a development preview, meaning the extension would not be widly released until the language server is merged into master. |
Additional Reference, Upcoming LSP Version 3.16 Specification with Semantic Tokens Support: |
The VS Code docs state:
To be honest, I would not mind the tiny delay, Since our language server is built in Crystal, it's fast, and it should not be a problem if we skip the tmLanguage definition.
The benefits would be correct highlighting, better maintainability.
For Reference:
The links on the bottom of the wiki page point to the API which is necessary.
It's also important to point out that this Semantic Tokens Spec is not specific to VS Code, It will be part of the next LSP version 3.16.0, so other editors will begin to adopt it.
Copied from conversation at Mint Lobby
The text was updated successfully, but these errors were encountered: