simple-completion-language-server
simple-completion-language-server copied to clipboard
external snippets
I am trying to get external snippets working. When I copy the and paste the external-snippets.toml the snippets validate. Not getting any snippets when it is set in languages.toml.
Also, with the external-snippets.toml - it always looks for [sources.path] . how can you set it so it changes snippets for the language file that is open? .py - scope python - .rb -> scope ruby
You did remember to run fetch external snippets, correct?
I'm pretty sure the scope flag exists purely to change the snippets based on the file open. Eg. Only snippets in scope python are used in .py files.
@dsisnero Hi. Did you run simple-completion-language-server fetch-external-snippet ?
my external snippets are working. I am on windows and when I have something like this in external-snippets.json. If I run
[[sources.paths]]
scope = ["ruby"]
path = "snippets/ruby/ruby.json"
if I run simple-completion-language-server validate-snippets I get
2024-12-02T19:42:01.399352Z ERROR simple_completion_language_server::snippets::config: On read dir "C:\\Users\\Dominic E Sisneros\\AppData\\Roaming\\helix\\snippets": The system cannot find the path specified. (os error 3)
What I want is the snippets directory to be relative to the external-snippets.toml file which is in c:\windows_home.config\helix
Try to set env variable EXTERNAL_SNIPPETS_CONFIG=c:\windows_home.config\helix and SNIPPETS_PATH=c:\windows_home.config\helix for all
simple-completion-language-server fetch-external-snippetsimple-completion-language-server validate-snippets- and lsp mod
@estin the issue here is the sample config in the README does not work if one only copies:
[[sources]]
name = "friendly-snippets" # optional name shown on snippet description
git = "https://github.com/rafamadriz/friendly-snippets.git" # git repo with snippets collections
and puts nothing else in the file the paths complain OP saw occurs.
It is not really clear what the [[source.paths]] is doing.... I copied the example into my external-snippets.toml to satisfy it. Would an empty [[source.paths]] work?
@shaleh if not declared at least one [[source.paths]] the external snippets feature would not work.
here validation routine
simple-completion-language-server validate-snippets
that was output this
thread 'main' panicked at src/main.rs:193:55:
Failed to validate snippets: TOML parse error at line 1, column 1
|
1 | [[sources]]
| ^^^^^^^^^^^^
missing field `paths`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
But behavior was changed now in https://github.com/estin/simple-completion-language-server/commit/6c508fffc428f7080e82ec6baee0789e5aa5cf7c on master - [[source.paths]] is optional now
And scls tries to load all snippets from declared source. Readme updated. But I'm bad docs writer at all and especially on english...