“Coc.nvim”的版本间的差异

来自wrc's Wiki
跳到导航 跳到搜索
 
第63行: 第63行:
 
=== coc-word ===
 
=== coc-word ===
  
补全常见英文单词,包括在 [https://github.com/neoclide/coc-sources coc-sources] 中。
+
补全常见英文单词,包括在 [https://github.com/neoclide/coc-sources coc-sources] 中。Source 可以理解为补全词的来源,使用 <code>:CocList sources</code> 来查看。
  
 
只对几个文件类型开启:<code>"coc.source.word.filetypes": ["text", "markdown", "html", "gitcommit", "mail", "nroff", "tex", ""],</code> <ref>[https://github.com/neoclide/coc.nvim/issues/1183#issuecomment-569338890 issue #1183, jrwrigh's comment]</ref>
 
只对几个文件类型开启:<code>"coc.source.word.filetypes": ["text", "markdown", "html", "gitcommit", "mail", "nroff", "tex", ""],</code> <ref>[https://github.com/neoclide/coc.nvim/issues/1183#issuecomment-569338890 issue #1183, jrwrigh's comment]</ref>

2021年5月2日 (日) 04:51的最新版本

coc.nvim(Conquer of Completion)是一个自动补全的框架,依赖 nodejs。

自动补全

对不同语言的支持和配置方式见 Language servers

通用的 language server

安装扩展 coc-diagnostic。如 shell:[1]

"diagnostic-languageserver.filetypes": {
    "sh": "shellcheck",
    "PKGBUILD": "pkgbuildcheck"
},
"diagnostic-languageserver.formatFiletypes": {
    "sh": "shfmt"
},
"diagnostic-languageserver.formatters": {
    "shfmt": {
        "command": "shfmt",
        "args": ["-i", "4", "-ci"]
    }
}

定义新的 linter 可参照已有的 Linters。如用于 PKGBUILD 的:[2]

"diagnostic-languageserver.linters": {
    "pkgbuildcheck": {
        "command": "shellcheck",
        "debounce": 100,
        "args": [
            "--shell=bash", "--exclude=SC2034,SC2154,SC2164",
            "--format", "json", "-"
        ],
        "sourceName": "shellcheck",
        "parseJson": {
            "line": "line",
            "column": "column",
            "endLine": "endLine",
            "endColumn": "endColumn",
            "message": "${message} [${code}]",
            "security": "level"
        },
        "securities": {
            "error": "error",
            "warning": "warning",
            "info": "info",
            "style": "hint"
        }
    }
},

扩展

可以为 coc.nvim 安装扩展(extension)

:CocInstall coc-json

coc-word

补全常见英文单词,包括在 coc-sources 中。Source 可以理解为补全词的来源,使用 :CocList sources 来查看。

只对几个文件类型开启:"coc.source.word.filetypes": ["text", "markdown", "html", "gitcommit", "mail", "nroff", "tex", ""], [3]

coc-rust-analyzer

配置选项

参考资料