-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
snippet support #395
Comments
Hi! I assume @archseer's intention was to support LSP snippets natively so I don't know if Regarding an eventual built-in support, if @archseer is favorable, you may want to get involved with helix development. Don't hesitate to drop in for a chat at Helix community Helix Space 😄 |
I think it's worth looking at the-way for inspiration. |
While all these snippets managers are nice, I think they should be implemented as a plugin.
It could be helpful to have simple built-in snippet support like vscode snippet:). Perhaps we can have a go at this? edit: I did have a go that (#1178), aiming to support LSP snippet. It's far from complete but now we at least know what difficulties we might encounter if we eventually try to implement snippet inside helix-core, and whether we should leave it to a plugin of some sort. |
Strongly need this feature. are there any alternatives? |
You can implement it and send us a PR? |
Here's the way I did it:
main: |-
func main() {
$1
}
err: |-
if err != nil {
$1
}
[[language]]
name = "go"
formatter = { command = "goimports"}
language-servers = ["gopls", "snippets-ls"]
[language-server.snippets-ls]
args = ["-config", "/Users/quantong/.config/helix/go-snippets.yaml"]
command="snippets-ls" Hope it helps. |
There is still one things bothering me right now about the snippet support: I don't know how hard this is to implement, but i at least wanted to let others know. |
I'm looking through the spec for 3.17, though it might be something you can answer directly? do you know if there is a way to do a streaming response with the language server protocol? I switched to gRPC more easily handle composable snippets, and potentially programmatic snippets. the former would be easy to handle, just build and replace prior to sending. The latter would be difficult, if not impossible, without bidirectional streaming. |
Just to add another LSP that has Snippets created for Helix https://github.com/estin/simple-completion-language-server by @estin |
Actually come to think of it, if all the community cares about is dynamic snippet support(vscode style snippets) I could create a fork of my project that swaps out grpc for another json RPC, and acts as a server just for helix. This would allow direct use of vscode snippets, plus support for snippets made of snippets, which is missing from vscode |
Support for VSCode snippets would be excellent!
…On Mon, 28 Aug 2023 at 18:20, Joshua Ferguson ***@***.***> wrote:
Actually come to think of it, if all the community cares about is dynamic
snippet support(vscode style snippets) I could create a fork of my project
that swaps out grpc for another json RPC, and acts as a server just for
helix.
This would allow direct use of vscode snippets, plus support for snippets
made of snippets, which is missing from vscode
—
Reply to this email directly, view it on GitHub
<#395 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOVIG2ATTRXEJOGLMHTY7LXXTHM7ANCNFSM47S5TSFA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I believe it is important not to overly rely on LSP (Language Server Protocol) and instead give more control to developers. Each developer has a clear understanding of the syntax of the language they are using, but everyone has slightly different coding preferences. It would be beneficial to allow developers to configure their own code snippet suggestions through a configuration file. |
If you need a simple snippet in the current version... C-g = [
":insert-output echo 'if err != nil {\\n}'",
"move_line_up",
"open_below",
] |
I'm sorry if I'm missing something here. Has snippet support not landed yet? Maybe I'm misunderstanding the docs, but shouldn't it be working according to them? https://docs.helix-editor.com/configuration.html?highlight=snippet#editorlsp-section |
Some snippet support has landed but not proper support, that will be #9801 |
Thank you kindly! |
I don't know if this would best go into a new issue, but auto expand support for snippets would be very nice. VSCode does not support it, but it is a game changer workflow wise. |
#9801 fully implements the snippet system, but a subsequent PR would still need to be made to implement a snippet manager inside Helix. |
So how exactly can I define snippets then? That does not seem to be described in the documentation. |
|
@UltraBlackLinux I've read that, but the way I've understood the other PR is that this should somehow be possible already, even if it might be cumbersome, and that a snippet manager might only make stuff more convenient. |
The quickest way to have snippets in Helix right now would be to use a language server for snippets, like: https://github.com/estin/simple-completion-language-server One additional benefit with that approach is that your snippets will also work in other editors like Zed. A full blown snippet manager will most likely make things easier for beginners, but it kinda depends on maintainers and the language server approach is adequate for now in my opinion. |
We do want a snippet manager in core IIRC. Pascal mentioned wanting to use it for #1438 as a special form of snippet. |
not exactly a feature request, more of request to implement a feature (or whether to wait until extensions are supported).
I've been working on what I hope will be a cross editor snippet manager (link to project) where the client and server are written in rust. while I'm looking to support a few features not covered in the specification (hoping to achieve eventual feature parity with ultisnips), the syntax I'm working to support is a superset of the syntax defined in the lsp specification.
even with support for only basic dynamic snippets(ie vscode snippets), a major usecase is reducing the amount of effort to support snippets by emerging editors to defining the interface (similar to the benefit of the LSP).
the project is at the point to where I can get completions per keystroke and insert/navigate snippets in vscode, but I'm depending on features specific to vscode. Working to support vscode first is also slowing me down because I really dislike/suck with javascript.
I'm aware that extension support is ongoing, but this also might be supportable by the editor itself (I'm trying to make it to where client implementation should be very little code) and also would make sense to a certain degree given that, while no language server (that I know of) handles snippets, snippets are a part of the LSP specification.
The text was updated successfully, but these errors were encountered: