Rename to nvim_lsp and nvim-lsp.

This commit is contained in:
Ashkan Kiani 2019-11-14 01:07:09 -08:00
parent 49ff7949f3
commit 9666b63a70
13 changed files with 102 additions and 102 deletions

View File

@ -72,7 +72,7 @@ Example:
skeleton.texlab.buf_build = buf_build
```
After you create a skeleton, you have to `require 'common_lsp/SERVER_NAME'` in
`lua/common_lsp.lua`, and that's it.
After you create a skeleton, you have to `require 'nvim_lsp/SERVER_NAME'` in
`lua/nvim_lsp.lua`, and that's it.
Generate docs and you're done.

View File

@ -14,9 +14,9 @@ things as much as you want in addition to the defaults that this provides.
**CONTRIBUTIONS ARE WELCOME!**
There's a lot of language servers in the world, and not enough time. See
[`lua/common_lsp/texlab.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/common_lsp/texlab.lua)
[`lua/nvim_lsp/texlab.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/texlab.lua)
and
[`lua/common_lsp/skeleton.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/common_lsp/skeleton.lua)
[`lua/nvim_lsp/skeleton.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/skeleton.lua)
for examples and ask me questions in the [Neovim
Gitter](https://gitter.im/neovim/neovim) to help me complete configurations for
*all the LSPs!*
@ -26,11 +26,11 @@ implemented from [this excellent list compiled by the coc.nvim
contributors](https://github.com/neoclide/coc.nvim/wiki/Language-servers) or
[this other excellent list from the emacs lsp-mode
contributors](https://github.com/emacs-lsp/lsp-mode#supported-languages)
and create a new file under `lua/common_lsp/SERVER_NAME.lua`.
and create a new file under `lua/nvim_lsp/SERVER_NAME.lua`.
- For a simple server which should only ever have one instance for the entire
neovim lifetime, I recommend copying `lua/common_lsp/texlab.lua`.
neovim lifetime, I recommend copying `lua/nvim_lsp/texlab.lua`.
- For servers which should have a different instance for each project root, I
recommend copying `lua/common_lsp/gopls.lua`.
recommend copying `lua/nvim_lsp/gopls.lua`.
## Progress
@ -55,22 +55,22 @@ In progress:
From vim:
```vim
call common_lsp#texlab({})
call common_lsp#gopls({})
call nvim_lsp#texlab({})
call nvim_lsp#gopls({})
" These are still TODO, but will be done.
call common_lsp#clangd({})
call common_lsp#ccls({})
call common_lsp#tsserver({})
call nvim_lsp#clangd({})
call nvim_lsp#ccls({})
call nvim_lsp#tsserver({})
" Or using a dynamic name.
call common_lsp#setup("texlab", {})
call common_lsp#setup("gopls", {})
call nvim_lsp#setup("texlab", {})
call nvim_lsp#setup("gopls", {})
```
From Lua:
```lua
require 'common_lsp'.texlab.setup {
require 'nvim_lsp'.texlab.setup {
name = "texlab_fancy";
log_level = vim.lsp.protocol.MessageType.Log;
settings = {
@ -82,15 +82,15 @@ require 'common_lsp'.texlab.setup {
}
}
local common_lsp = require 'common_lsp'
local nvim_lsp = require 'nvim_lsp'
-- Customize how to find the root_dir
common_lsp.gopls.setup {
root_dir = common_lsp.util.root_pattern(".git");
nvim_lsp.gopls.setup {
root_dir = nvim_lsp.util.root_pattern(".git");
}
-- Build the current buffer.
require 'common_lsp'.texlab.buf_build(0)
require 'nvim_lsp'.texlab.buf_build(0)
```
```
@ -98,12 +98,12 @@ These are functions to set up servers more easily with some server specific
defaults and more server specific things like commands or different
diagnostics.
Servers may define extra functions on the `common_lsp.SERVER` table, e.g.
`common_lsp.texlab.buf_build({bufnr})`.
Servers may define extra functions on the `nvim_lsp.SERVER` table, e.g.
`nvim_lsp.texlab.buf_build({bufnr})`.
The main setup signature will be:
common_lsp.SERVER.setup({config})
nvim_lsp.SERVER.setup({config})
{config} is the same as |vim.lsp.start_client()|, but with some
additions and changes:
@ -121,14 +121,14 @@ common_lsp.SERVER.setup({config})
If nil is returned, the buffer is skipped.
See |common_lsp.util.search_ancestors()| and the functions which use it:
- |common_lsp.util.root_pattern(patterns...)| finds an ancestor which
See |nvim_lsp.util.search_ancestors()| and the functions which use it:
- |nvim_lsp.util.root_pattern(patterns...)| finds an ancestor which
- contains one of the files in `patterns...`. This is equivalent
to coc.nvim's "rootPatterns"
- More specific utilities:
- |common_lsp.util.find_git_root()|
- |common_lsp.util.find_node_modules_root()|
- |common_lsp.util.find_package_json_root()|
- |nvim_lsp.util.find_git_root()|
- |nvim_lsp.util.find_node_modules_root()|
- |nvim_lsp.util.find_package_json_root()|
{name}
Defaults to the server's name.
@ -174,8 +174,8 @@ as compile_commands.json or, for simpler projects, a compile_flags.txt.
common_lsp.clangd.setup({config})
common_lsp#setup("clangd", {config})
nvim_lsp.clangd.setup({config})
nvim_lsp#setup("clangd", {config})
```
Default Values:
@ -195,8 +195,8 @@ A completion engine built from scratch for (la)tex.
common_lsp.texlab.setup({config})
common_lsp#setup("texlab", {config})
nvim_lsp.texlab.setup({config})
nvim_lsp#setup("texlab", {config})
```
Commands:
@ -225,8 +225,8 @@ Google's lsp server for golang.
common_lsp.gopls.setup({config})
common_lsp#setup("gopls", {config})
nvim_lsp.gopls.setup({config})
nvim_lsp#setup("gopls", {config})
```
Default Values:

View File

@ -14,9 +14,9 @@ things as much as you want in addition to the defaults that this provides.
**CONTRIBUTIONS ARE WELCOME!**
There's a lot of language servers in the world, and not enough time. See
[`lua/common_lsp/texlab.lua`](https://github.com/norcalli/nvim-common-lsp/blob/master/lua/common_lsp/texlab.lua)
[`lua/nvim_lsp/texlab.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/texlab.lua)
and
[`lua/common_lsp/skeleton.lua`](https://github.com/norcalli/nvim-common-lsp/blob/master/lua/common_lsp/skeleton.lua)
[`lua/nvim_lsp/skeleton.lua`](https://github.com/neovim/nvim-lsp/blob/master/lua/nvim_lsp/skeleton.lua)
for examples and ask me questions in the [Neovim
Gitter](https://gitter.im/neovim/neovim) to help me complete configurations for
*all the LSPs!*
@ -26,17 +26,17 @@ implemented from [this excellent list compiled by the coc.nvim
contributors](https://github.com/neoclide/coc.nvim/wiki/Language-servers) or
[this other excellent list from the emacs lsp-mode
contributors](https://github.com/emacs-lsp/lsp-mode#supported-languages)
and create a new file under `lua/common_lsp/SERVER_NAME.lua`.
and create a new file under `lua/nvim_lsp/SERVER_NAME.lua`.
- For a simple server which should only ever have one instance for the entire
neovim lifetime, I recommend copying `lua/common_lsp/texlab.lua`.
neovim lifetime, I recommend copying `lua/nvim_lsp/texlab.lua`.
- For servers which should have a different instance for each project root, I
recommend copying `lua/common_lsp/gopls.lua`.
recommend copying `lua/nvim_lsp/gopls.lua`.
## Progress
Implemented:
- [gopls](https://github.com/norcalli/nvim-common-lsp#gopls) (has some errors)
- [texlab](https://github.com/norcalli/nvim-common-lsp#texlab)
- [gopls](https://github.com/neovim/nvim-lsp#gopls) (has some errors)
- [texlab](https://github.com/neovim/nvim-lsp#texlab)
Planned servers to implement (by me, but contributions welcome anyway):
- [clangd](https://clang.llvm.org/extra/clangd/Installation.html)
@ -49,28 +49,28 @@ In progress:
## Install
`Plug 'norcalli/nvim-common-lsp'`
`Plug 'neovim/nvim-lsp'`
## Use
From vim:
```vim
call common_lsp#texlab({})
call common_lsp#gopls({})
call nvim_lsp#texlab({})
call nvim_lsp#gopls({})
" These are still TODO, but will be done.
call common_lsp#clangd({})
call common_lsp#ccls({})
call common_lsp#tsserver({})
call nvim_lsp#clangd({})
call nvim_lsp#ccls({})
call nvim_lsp#tsserver({})
" Or using a dynamic name.
call common_lsp#setup("texlab", {})
call common_lsp#setup("gopls", {})
call nvim_lsp#setup("texlab", {})
call nvim_lsp#setup("gopls", {})
```
From Lua:
```lua
require 'common_lsp'.texlab.setup {
require 'nvim_lsp'.texlab.setup {
name = "texlab_fancy";
log_level = vim.lsp.protocol.MessageType.Log;
settings = {
@ -82,15 +82,15 @@ require 'common_lsp'.texlab.setup {
}
}
local common_lsp = require 'common_lsp'
local nvim_lsp = require 'nvim_lsp'
-- Customize how to find the root_dir
common_lsp.gopls.setup {
root_dir = common_lsp.util.root_pattern(".git");
nvim_lsp.gopls.setup {
root_dir = nvim_lsp.util.root_pattern(".git");
}
-- Build the current buffer.
require 'common_lsp'.texlab.buf_build(0)
require 'nvim_lsp'.texlab.buf_build(0)
```
```
@ -98,12 +98,12 @@ These are functions to set up servers more easily with some server specific
defaults and more server specific things like commands or different
diagnostics.
Servers may define extra functions on the `common_lsp.SERVER` table, e.g.
`common_lsp.texlab.buf_build({bufnr})`.
Servers may define extra functions on the `nvim_lsp.SERVER` table, e.g.
`nvim_lsp.texlab.buf_build({bufnr})`.
The main setup signature will be:
common_lsp.SERVER.setup({config})
nvim_lsp.SERVER.setup({config})
{config} is the same as |vim.lsp.start_client()|, but with some
additions and changes:
@ -121,14 +121,14 @@ common_lsp.SERVER.setup({config})
If nil is returned, the buffer is skipped.
See |common_lsp.util.search_ancestors()| and the functions which use it:
- |common_lsp.util.root_pattern(patterns...)| finds an ancestor which
See |nvim_lsp.util.search_ancestors()| and the functions which use it:
- |nvim_lsp.util.root_pattern(patterns...)| finds an ancestor which
- contains one of the files in `patterns...`. This is equivalent
to coc.nvim's "rootPatterns"
- More specific utilities:
- |common_lsp.util.find_git_root()|
- |common_lsp.util.find_node_modules_root()|
- |common_lsp.util.find_package_json_root()|
- |nvim_lsp.util.find_git_root()|
- |nvim_lsp.util.find_node_modules_root()|
- |nvim_lsp.util.find_package_json_root()|
{name}
Defaults to the server's name.

View File

@ -1,12 +0,0 @@
function! common_lsp#setup(name, config)
return luaeval("require'common_lsp'[_A[1]].setup(_A[2])", [a:name, a:config])
endfunction
" function! common_lsp#texlab(config)
" call common_lsp#setup("texlab", a:config)
" endfunction
" function! common_lsp#gopls(config)
" call common_lsp#setup("gopls", a:config)
" endfunction

12
autoload/nvim_lsp.vim Normal file
View File

@ -0,0 +1,12 @@
function! nvim_lsp#setup(name, config)
return luaeval("require'nvim_lsp'[_A[1]].setup(_A[2])", [a:name, a:config])
endfunction
" function! nvim_lsp#texlab(config)
" call nvim_lsp#setup("texlab", a:config)
" endfunction
" function! nvim_lsp#gopls(config)
" call nvim_lsp#setup("gopls", a:config)
" endfunction

View File

@ -1,16 +0,0 @@
local skeleton = require 'common_lsp/skeleton'
require 'common_lsp/gopls'
require 'common_lsp/texlab'
require 'common_lsp/clangd'
local M = {
util = require 'common_lsp/util';
}
local mt = {}
function mt:__index(k)
return skeleton[k]
end
return setmetatable(M, mt)
-- vim:et ts=2 sw=2

16
lua/nvim_lsp.lua Normal file
View File

@ -0,0 +1,16 @@
local skeleton = require 'nvim_lsp/skeleton'
require 'nvim_lsp/gopls'
require 'nvim_lsp/texlab'
require 'nvim_lsp/clangd'
local M = {
util = require 'nvim_lsp/util';
}
local mt = {}
function mt:__index(k)
return skeleton[k]
end
return setmetatable(M, mt)
-- vim:et ts=2 sw=2

View File

@ -1,5 +1,5 @@
local skeleton = require 'common_lsp/skeleton'
local util = require 'common_lsp/util'
local skeleton = require 'nvim_lsp/skeleton'
local util = require 'nvim_lsp/util'
local lsp = vim.lsp
local default_capabilities = lsp.protocol.make_client_capabilities()

View File

@ -1,5 +1,5 @@
local skeleton = require 'common_lsp/skeleton'
local util = require 'common_lsp/util'
local skeleton = require 'nvim_lsp/skeleton'
local util = require 'nvim_lsp/util'
local lsp = vim.lsp
skeleton.gopls = {

View File

@ -1,4 +1,4 @@
local util = require 'common_lsp/util'
local util = require 'nvim_lsp/util'
local api, validate, lsp = vim.api, vim.validate, vim.lsp
local tbl_extend = vim.tbl_extend
@ -76,7 +76,7 @@ function skeleton.__newindex(t, template_name, template)
trigger = "BufReadPost *"
end
api.nvim_command(string.format(
"autocmd %s lua require'common_lsp'[%q].manager.try_add()"
"autocmd %s lua require'nvim_lsp'[%q].manager.try_add()"
, trigger
, config.name
))
@ -118,7 +118,7 @@ function skeleton.__newindex(t, template_name, template)
M._setup_buffer(client.id)
else
api.nvim_command(string.format(
"autocmd BufEnter <buffer=%d> ++once lua require'common_lsp'[%q]._setup_buffer(%d)"
"autocmd BufEnter <buffer=%d> ++once lua require'nvim_lsp'[%q]._setup_buffer(%d)"
, template_name
, bufnr
, client.id

View File

@ -1,5 +1,5 @@
local skeleton = require 'common_lsp/skeleton'
local util = require 'common_lsp/util'
local skeleton = require 'nvim_lsp/skeleton'
local util = require 'nvim_lsp/util'
local lsp = vim.lsp
local cwd = vim.loop.cwd()

View File

@ -84,7 +84,7 @@ function M.create_module_commands(module_name, commands)
table.insert(parts, command_name)
-- The command definition.
table.insert(parts,
string.format("lua require'common_lsp'[%q].commands[%q][1]()", module_name, command_name))
string.format("lua require'nvim_lsp'[%q].commands[%q][1]()", module_name, command_name))
api.nvim_command(table.concat(parts, " "))
end
end

View File

@ -1,4 +1,4 @@
local skeleton = require 'common_lsp/skeleton'
local skeleton = require 'nvim_lsp/skeleton'
local inspect = vim.inspect
local function filter(...)
@ -91,8 +91,8 @@ for k, v in pairs(skeleton) do
## {{template_name}}
{{preamble}}
common_lsp.{{template_name}}.setup({config})
common_lsp#setup("{{template_name}}", {config})
nvim_lsp.{{template_name}}.setup({config})
nvim_lsp#setup("{{template_name}}", {config})
```
{{body}}