Skip to content

d1y/scls

Repository files navigation

scls

Fork by https://github.com/estin/simple-completion-language-server

具体改动请参考 #6 该 PR

zed 插件仓库: https://github.com/d1y/simple-completion-zed

暂时可以用这个过渡一下, 还是等官方支持这些功能吧

路径提示 代码片段
image image

Install

Homebrew:

brew tap d1ylab/homebrew-tap
brew install scls

From GitHub:

$ cargo install --git https://github.com/d1y/scls

From local repository:

$ git clone https://github.com/d1y/scls
$ cd scls
$ cargo install --path .

Configure

zed-editor:

"lsp": {
  "scls": {
    "initialization_options": {
      "max_completion_items": 6, // set max completion results len for each group: words, snippets, unicode-input
      "feature_words": false, // enable completion by word
      "feature_unicode_input": false, // enable "unicode input"
      "snippets_first": true, // completions will return before snippets by default
      "feature_snippets": true, // enable snippets
      "feature_paths": true // enable path completion
    }
  }
}

Snippets

代码片段目录在 ~/.scls/snippets, 示例(~/.scls/snippets/go.toml):

[[snippets]]
prefix = "err"
scope = [ "go" ]
body = "if err := $1; err != nil {\n\t$2\t\n}"

[[snippets]]
prefix = "td"
scope = [ "javascript", "typescript", "go", "rust", "vue" ]
body = "// TODO: impl this"

[[snippets]]
prefix = "fx"
scope = [ "javascript", "typescript", "go", "rust", "vue" ]
body = "// FIXME: $1"

可以使用

simple-completion-language-server fetch-snippets

命令来调用 Nodejs 自动拉取 https://github.com/rafamadriz/friendly-snippets 仓库代码片段(它会自动生成配置文件)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5