Closed adaszko closed 1 year ago
settings = {
["rust-analyzer"] = {
completion = {
snippets = {
custom = {
["thread spawn"] = {
prefix = { "spawn", "tspawn" },
body = { "thread::spawn(move || {", " $0", "});" },
description = "Insert a thread::spawn call",
requires = "std::thread",
scope = "expr",
},
},
},
},
checkOnSave = {
command = "clippy",
},
},
},
Works for me, Try it this way
Thank you! For the posteriority, here’s a full example that worked for me: https://github.com/IWANABETHATGUY/nvim-config/blob/ca33c2631e29e50c9eb725567a8b5ca85cbec262/lua/user/rust-tools.lua#L91
Hi 👋
Are User Snippet Completions supported? They’re more precise than language-agnostic snippets and thus more useful.
The only information I found on them is this unanswered question: https://neovim.discourse.group/t/how-to-add-custom-snippets-to-rust-analyzer/3806 . I tried this without success:
Thanks!