diff options
| author | Hirokazu Hata <h.hata.ai.t@gmail.com> | 2020-11-15 15:15:10 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-15 15:15:10 +0900 |
| commit | 42a13e5ad99b688bc7376fa4d236e924985d04cc (patch) | |
| tree | c93c54f94b35b1a7b20f6a39ffac485ca7410d5b /scripts | |
| parent | Merge pull request #238 from steelsojka/angular-ls (diff) | |
| parent | Update README.md (diff) | |
| download | nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.tar nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.tar.gz nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.tar.bz2 nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.tar.lz nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.tar.xz nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.tar.zst nvim-lspconfig-42a13e5ad99b688bc7376fa4d236e924985d04cc.zip | |
Merge pull request #348 from h-michael/rename
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/README_template.md | 56 | ||||
| -rw-r--r-- | scripts/docgen.lua | 12 | ||||
| -rw-r--r-- | scripts/run_test.sh | 4 |
3 files changed, 36 insertions, 36 deletions
diff --git a/scripts/README_template.md b/scripts/README_template.md index 311a9717..51bc3d77 100644 --- a/scripts/README_template.md +++ b/scripts/README_template.md @@ -26,10 +26,10 @@ best practices for a given language. Ask questions in [Neovim Gitter](https://gitter.im/neovim/neovim). 2. Choose a language from [the coc.nvim wiki](https://github.com/neoclide/coc.nvim/wiki/Language-servers) or [emacs-lsp](https://github.com/emacs-lsp/lsp-mode#supported-languages). -3. Create a new file at `lua/nvim_lsp/SERVER_NAME.lua`. - - Copy an [existing config](https://github.com/neovim/nvim-lspconfig/blob/master/lua/nvim_lsp/) +3. Create a new file at `lua/lspconfig/SERVER_NAME.lua`. + - Copy an [existing config](https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/) to get started. Most configs are simple. For an extensive example see - [texlab.lua](https://github.com/neovim/nvim-lspconfig/blob/master/lua/nvim_lsp/texlab.lua). + [texlab.lua](https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/texlab.lua). ## Install @@ -48,7 +48,7 @@ diagnostics. ```lua vim.cmd('packadd nvim-lspconfig') -- If installed as a Vim "package". -require'nvim_lsp'.<config>.setup{name=…, settings = {…}, …} +require'lspconfig'.<config>.setup{name=…, settings = {…}, …} ``` If you want to add this to your vimrc, you will need to enclose it in a `lua` block. @@ -56,7 +56,7 @@ If you want to add this to your vimrc, you will need to enclose it in a `lua` bl ```vim lua <<EOF vim.cmd('packadd nvim-lspconfig') -- If installed as a Vim "package". -require'nvim_lsp'.<config>.setup{name=…, settings = {…}, …} +require'lspconfig'.<config>.setup{name=…, settings = {…}, …} EOF ``` @@ -65,7 +65,7 @@ given there to your `init.vim`. **All examples are given in Lua,** see `:help :lua-heredoc` to use Lua from your init.vim. Some configs may define additional server-specific functions, e.g. the `texlab` -config provides `nvim_lsp.texlab.buf_build({bufnr})`. +config provides `lspconfig.texlab.buf_build({bufnr})`. If you want to see the location of log file, you can run this in neovim: @@ -80,7 +80,7 @@ For the `gopls` config, that would be: ```lua vim.cmd('packadd nvim-lspconfig') -- If installed as a Vim "package". -require'nvim_lsp'.gopls.setup{} +require'lspconfig'.gopls.setup{} ``` ### Example: override some defaults @@ -89,9 +89,9 @@ To set some config properties at `setup()`, specify their keys. For example to change how the "project root" is found, set the `root_dir` key: ```lua -local nvim_lsp = require'nvim_lsp' -nvim_lsp.gopls.setup{ - root_dir = nvim_lsp.util.root_pattern('.git'); +local lspconfig = require'lspconfig' +lspconfig.gopls.setup{ + root_dir = lspconfig.util.root_pattern('.git'); } ``` @@ -99,8 +99,8 @@ The [documentation](#configurations) for each config lists default values and additional optional properties. ```lua -local nvim_lsp = require'nvim_lsp' -nvim_lsp.texlab.setup{ +local lspconfig = require'lspconfig' +lspconfig.texlab.setup{ name = 'texlab_fancy'; log_level = vim.lsp.protocol.MessageType.Log; message_level = vim.lsp.protocol.MessageType.Log; @@ -116,29 +116,29 @@ nvim_lsp.texlab.setup{ ### Example: custom config -To configure a custom/private server, just require `nvim_lsp/configs` and do +To configure a custom/private server, just require `lspconfig/configs` and do the same as we do if we were adding it to the repository itself. 1. Define the config: `configs.foo_lsp = { … }` -2. Call `setup()`: `require'nvim_lsp'.foo_lsp.setup{}` +2. Call `setup()`: `require'lspconfig'.foo_lsp.setup{}` ```lua -local nvim_lsp = require'nvim_lsp' -local configs = require'nvim_lsp/configs' +local lspconfig = require'lspconfig' +local configs = require'lspconfig/configs' -- Check if it's already defined for when I reload this file. -if not nvim_lsp.foo_lsp then +if not lspconfig.foo_lsp then configs.foo_lsp = { default_config = { cmd = {'/home/ashkan/works/3rd/lua-language-server/run.sh'}; filetypes = {'lua'}; root_dir = function(fname) - return nvim_lsp.util.find_git_ancestor(fname) or vim.loop.os_homedir() + return lspconfig.util.find_git_ancestor(fname) or vim.loop.os_homedir() end; settings = {}; }; } end -nvim_lsp.foo_lsp.setup{} +lspconfig.foo_lsp.setup{} ``` ### Example: override default config @@ -146,10 +146,10 @@ nvim_lsp.foo_lsp.setup{} If you want to change default configs for all servers, you can override default_config like this. ```lua -local nvim_lsp = require'nvim_lsp' -nvim_lsp.util.default_config = vim.tbl_extend( +local lspconfig = require'lspconfig' +lspconfig.util.default_config = vim.tbl_extend( "force", - nvim_lsp.util.default_config, + lspconfig.util.default_config, { log_level = lsp.protocol.MessageType.Warning.Error } ) ``` @@ -171,7 +171,7 @@ Use `:LspInstallInfo` to see install info. The `setup()` interface: ``` -nvim_lsp.SERVER.setup{config} +lspconfig.SERVER.setup{config} The `config` parameter has the same shape as that of |vim.lsp.start_client()|, with these additions and changes: @@ -190,14 +190,14 @@ nvim_lsp.SERVER.setup{config} If nil is returned, the buffer is skipped. - See |nvim_lsp.util.search_ancestors()| and the functions which use it: - - |nvim_lsp.util.root_pattern(patterns...)| finds an ancestor which + See |lspconfig.util.search_ancestors()| and the functions which use it: + - |lspconfig.util.root_pattern(patterns...)| finds an ancestor which - contains one of the files in `patterns...`. This is equivalent to coc.nvim's "rootPatterns" - Related utilities for common tools: - - |nvim_lsp.util.find_git_root()| - - |nvim_lsp.util.find_node_modules_root()| - - |nvim_lsp.util.find_package_json_root()| + - |lspconfig.util.find_git_root()| + - |lspconfig.util.find_node_modules_root()| + - |lspconfig.util.find_package_json_root()| {name} Defaults to the server's name. diff --git a/scripts/docgen.lua b/scripts/docgen.lua index fb373f9e..7d963087 100644 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -1,6 +1,6 @@ -require 'nvim_lsp' -local configs = require 'nvim_lsp/configs' -local util = require 'nvim_lsp/util' +require 'lspconfig' +local configs = require 'lspconfig/configs' +local util = require 'lspconfig/util' local inspect = vim.inspect local uv = vim.loop local fn = vim.fn @@ -68,7 +68,7 @@ local lsp_section_template = [[ {{preamble}} ```lua -require'nvim_lsp'.{{template_name}}.setup{} +require'lspconfig'.{{template_name}}.setup{} {{body}} ``` @@ -76,9 +76,9 @@ require'nvim_lsp'.{{template_name}}.setup{} local function require_all_configs() -- Configs are lazy-loaded, tickle them to populate the `configs` singleton. - for _,v in ipairs(vim.fn.glob('lua/nvim_lsp/*.lua', 1, 1)) do + for _,v in ipairs(vim.fn.glob('lua/lspconfig/*.lua', 1, 1)) do local module_name = v:gsub('.*/', ''):gsub('%.lua$', '') - require('nvim_lsp/'..module_name) + require('lspconfig/'..module_name) end end diff --git a/scripts/run_test.sh b/scripts/run_test.sh index 164a4392..7221ef80 100644 --- a/scripts/run_test.sh +++ b/scripts/run_test.sh @@ -9,5 +9,5 @@ fi cd ./neovim make functionaltest \ - BUSTED_ARGS="--lpath=$PJ_ROOT/?.lua --lpath=$PJ_ROOT/lua/?.lua --lpath=$PJ_ROOT/lua/nvim_lsp/?.lua" \ - TEST_FILE="../test/nvim_lsp_spec.lua" + BUSTED_ARGS="--lpath=$PJ_ROOT/?.lua --lpath=$PJ_ROOT/lua/?.lua --lpath=$PJ_ROOT/lua/lspconfig/?.lua" \ + TEST_FILE="../test/lspconfig_spec.lua" |
