-
Notifications
You must be signed in to change notification settings - Fork 76
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
FR: Make available as LSP #936
Comments
Interesting idea. I can see the value in this, although building out a fully fledged language server that conforms to the protocol might be a bit overkill for the tool itself. Maybe it should be a wrapper binary tool, not sure yet. |
Would using Implementing a full LSP wrapper for stylua seems a waste of energy when there already are tools that are explicitly made to wrap things like formatters to be available via LSP. (Note I haven't used it, as I'm happy with how Another consideration would be to have a common crate to provide an LSP wrapper, but I'm not sure how much that would actually be used. |
As it is already pointed out biome is also written in rust and has a language client available as a subcommand of its CLI. The LS implementation can be checked out here for the inspiration or perhaps it is possible to reuse some of it. Personally I think if the language client can be a part of the stylua binary itself - that would provide the best user experience and performance end to end. Another options is to have a typescript/javascript language server as part of the existing npm package. It can shell out to the CLI similar to the VS Code plugin, perhaps some of the code can be reused. Though, the user will have to make sure that stylua is installed through the npm specifically. |
I've just published to npm a prototype that works good enough for me. It is quite similar code wise to the current vscode plugin. Hopefully this helps. |
@antonk52 awesome! I just gave it a try, and so far it seems to be working as expected.
I also opened a PR to have the package added to |
Any thoughts on integrating |
Many formatters/linters such as
biome
orruff
are also available as LSP, even though they aren't "real" language servers.Offering an LSP, even if it is just for the formatting command, has its advantages, as it allows for easier integration into editors. With editors like nvim, for example, integrating
stylua
requires an extra plugin, while an LSP could be used out of the box.The text was updated successfully, but these errors were encountered: