aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2019-11-14 19:46:50 +0100
committerAshkan Kiani <ashkan.k.kiani@gmail.com>2019-11-14 10:46:50 -0800
commit9100b3af6e310561167361536fd162bbe588049a (patch)
treeb9f67c9b0bd05d222dd26533dd40f5075de96755
parentFix clangd's status (diff)
downloadnvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.tar
nvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.tar.gz
nvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.tar.bz2
nvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.tar.lz
nvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.tar.xz
nvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.tar.zst
nvim-lspconfig-9100b3af6e310561167361536fd162bbe588049a.zip
Add initial support for python-language-server (#3)
* initial support for python-language-server * put settings in documentation also: update docgen script update setup call examples in README_preamble
-rw-r--r--README.md64
-rw-r--r--README_preamble.md10
-rw-r--r--lua/nvim_lsp.lua1
-rw-r--r--lua/nvim_lsp/pyls.lua65
-rw-r--r--scripts/docgen.lua3
5 files changed, 124 insertions, 19 deletions
diff --git a/README.md b/README.md
index 551e51ed..a7446a29 100644
--- a/README.md
+++ b/README.md
@@ -55,17 +55,9 @@ In progress:
From vim:
```vim
-call nvim_lsp#texlab({})
-call nvim_lsp#gopls({})
-
-" These are still TODO, but will be done.
-call nvim_lsp#clangd({})
-call nvim_lsp#ccls({})
-call nvim_lsp#tsserver({})
-
-" Or using a dynamic name.
call nvim_lsp#setup("texlab", {})
call nvim_lsp#setup("gopls", {})
+call nvim_lsp#setup("pyls", {})
```
From Lua:
@@ -185,6 +177,60 @@ nvim_lsp#setup("clangd", {config})
root_dir = root_pattern("compile_commands.json", "compile_flags.txt", ".git")
settings = {}
```
+## pyls
+
+https://github.com/palantir/python-language-server
+
+python-language-server, a language server for Python
+
+the following settings (with default options) are supported:
+
+```
+settings = {
+ pyls = {
+ enable = true;
+ trace = { server = "verbose"; };
+ commandPath = "";
+ configurationSources = { "pycodestyle" };
+ plugins = {
+ jedi_completion = { enabled = true; };
+ jedi_hover = { enabled = true; };
+ jedi_references = { enabled = true; };
+ jedi_signature_help = { enabled = true; };
+ jedi_symbols = {
+ enabled = true;
+ all_scopes = true;
+ };
+ mccabe = {
+ enabled = true;
+ threshold = 15;
+ };
+ preload = { enabled = true; };
+ pycodestyle = { enabled = true; };
+ pydocstyle = {
+ enabled = false;
+ match = "(?!test_).*\\.py";
+ matchDir = "[^\\.].*";
+ };
+ pyflakes = { enabled = true; };
+ rope_completion = { enabled = true; };
+ yapf = { enabled = true; };
+ };
+ };
+};
+```
+
+```
+nvim_lsp.pyls.setup({config})
+nvim_lsp#setup("pyls", {config})
+
+ Default Values:
+ cmd = { "pyls" }
+ filetypes = { "python" }
+ log_level = 2
+ root_dir = vim's starting directory
+ settings = {}
+```
## texlab
https://texlab.netlify.com/
diff --git a/README_preamble.md b/README_preamble.md
index ea16caf7..65bf5235 100644
--- a/README_preamble.md
+++ b/README_preamble.md
@@ -55,17 +55,9 @@ In progress:
From vim:
```vim
-call nvim_lsp#texlab({})
-call nvim_lsp#gopls({})
-
-" These are still TODO, but will be done.
-call nvim_lsp#clangd({})
-call nvim_lsp#ccls({})
-call nvim_lsp#tsserver({})
-
-" Or using a dynamic name.
call nvim_lsp#setup("texlab", {})
call nvim_lsp#setup("gopls", {})
+call nvim_lsp#setup("pyls", {})
```
From Lua:
diff --git a/lua/nvim_lsp.lua b/lua/nvim_lsp.lua
index 7868e3a4..a28bc4d5 100644
--- a/lua/nvim_lsp.lua
+++ b/lua/nvim_lsp.lua
@@ -2,6 +2,7 @@ local skeleton = require 'nvim_lsp/skeleton'
require 'nvim_lsp/gopls'
require 'nvim_lsp/texlab'
require 'nvim_lsp/clangd'
+require 'nvim_lsp/pyls'
local M = {
util = require 'nvim_lsp/util';
diff --git a/lua/nvim_lsp/pyls.lua b/lua/nvim_lsp/pyls.lua
new file mode 100644
index 00000000..c4691f5d
--- /dev/null
+++ b/lua/nvim_lsp/pyls.lua
@@ -0,0 +1,65 @@
+local skeleton = require 'nvim_lsp/skeleton'
+local util = require 'nvim_lsp/util'
+local lsp = vim.lsp
+
+local cwd = vim.loop.cwd()
+
+skeleton.pyls = {
+ default_config = {
+ cmd = {"pyls"};
+ filetypes = {"python"};
+ root_dir = function() return cwd end;
+ log_level = lsp.protocol.MessageType.Warning;
+ settings = {};
+ };
+ -- on_new_config = function(new_config) end;
+ -- on_attach = function(client, bufnr) end;
+ docs = {
+ description = [[
+https://github.com/palantir/python-language-server
+
+python-language-server, a language server for Python
+
+the following settings (with default options) are supported:
+```lua
+settings = {
+ pyls = {
+ enable = true;
+ trace = { server = "verbose"; };
+ commandPath = "";
+ configurationSources = { "pycodestyle" };
+ plugins = {
+ jedi_completion = { enabled = true; };
+ jedi_hover = { enabled = true; };
+ jedi_references = { enabled = true; };
+ jedi_signature_help = { enabled = true; };
+ jedi_symbols = {
+ enabled = true;
+ all_scopes = true;
+ };
+ mccabe = {
+ enabled = true;
+ threshold = 15;
+ };
+ preload = { enabled = true; };
+ pycodestyle = { enabled = true; };
+ pydocstyle = {
+ enabled = false;
+ match = "(?!test_).*\\.py";
+ matchDir = "[^\\.].*";
+ };
+ pyflakes = { enabled = true; };
+ rope_completion = { enabled = true; };
+ yapf = { enabled = true; };
+ };
+ };
+};
+```
+ ]];
+ default_config = {
+ root_dir = "vim's starting directory";
+ };
+ };
+};
+
+-- vim:et ts=2 sw=2
diff --git a/scripts/docgen.lua b/scripts/docgen.lua
index 7b338546..a2583a36 100644
--- a/scripts/docgen.lua
+++ b/scripts/docgen.lua
@@ -1,3 +1,4 @@
+require 'nvim_lsp'
local skeleton = require 'nvim_lsp/skeleton'
local inspect = vim.inspect
@@ -38,7 +39,7 @@ local function indent(n, s)
return table.concat(lines, '\n')
end
-local writer = io.popen("cat README_preamble.md - > README.md common-lsp-docs.md", "w")
+local writer = io.popen("cat README_preamble.md - > README.md", "w")
for k, v in pairs(skeleton) do
local tconf = v.template_config