aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2020-01-01 07:15:50 +0900
committerJustin M. Keyes <justinkz@gmail.com>2019-12-31 14:15:50 -0800
commit10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15 (patch)
tree7eef1897eafc3607927b2006715e4e56b3ecd843
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.tar
nvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.tar.gz
nvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.tar.bz2
nvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.tar.lz
nvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.tar.xz
nvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.tar.zst
nvim-lspconfig-10d3a9bde1d72bd3dfdbffbc317ef6b36ff9dd15.zip
CI: luacheck #86
-rw-r--r--.github/workflows/docgen.yml (renamed from .github/workflows/main.yml)2
-rw-r--r--.github/workflows/lint.yml22
-rw-r--r--.gitignore1
-rw-r--r--.luacheckrc14
-rw-r--r--CONTRIBUTING.md1
-rw-r--r--README.md26
-rw-r--r--lua/nvim_lsp/intelephense.lua2
-rw-r--r--lua/nvim_lsp/pyls.lua1
-rw-r--r--lua/nvim_lsp/pyls_ms.lua9
-rw-r--r--lua/nvim_lsp/texlab.lua28
-rw-r--r--lua/nvim_lsp/tsserver.lua2
-rw-r--r--lua/nvim_lsp/util.lua30
-rw-r--r--lua/nvim_lsp/vimls.lua1
-rw-r--r--scripts/docgen.lua14
14 files changed, 90 insertions, 63 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/docgen.yml
index 1958fc98..78ccdf6c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/docgen.yml
@@ -1,4 +1,4 @@
-name: CI
+name: docgen
on: [push]
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..fad473da
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,22 @@
+name: lint
+
+on:
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ lint:
+ runs-on: [ubuntu-latest]
+ steps:
+ - name: Checkout sources
+ uses: actions/checkout@v1
+ - name: Setup luacheck
+ run: |
+ sudo apt update &&
+ sudo apt install -y lua5.1 luarocks &&
+ sudo luarocks install luacheck
+ - name: Run luacheck
+ run: |
+ luacheck .
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..748eabfd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.luacheckcache
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 00000000..a0e81d60
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,14 @@
+-- vim: ft=lua tw=80
+
+-- Rerun tests only if their modification time changed.
+cache = true
+
+ignore = {
+ "212", -- Unused argument, In the case of callback function, _arg_name is easier to understand than _, so this option is set to off.
+ "631", -- max_line_length, vscode pkg URL is too long
+}
+
+-- Global objects defined by the C code
+read_globals = {
+ "vim",
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d3f314e3..f89c8426 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,6 +2,7 @@
- Neovim :P
- docgen requires a unix system.
+- luacheck for linting Lua code. ([Install](https://github.com/mpeterv/luacheck#installation))
# Generating docs
diff --git a/README.md b/README.md
index 0d17439e..6909454b 100644
--- a/README.md
+++ b/README.md
@@ -1193,7 +1193,7 @@ require'nvim_lsp'.hie.setup{}
https://intelephense.com/
-`intelephense` can be installed via `:LspInstall intelephense` or by yourself with `npm`:
+`intelephense` can be installed via `:LspInstall intelephense` or by yourself with `npm`:
```sh
npm install -g intelephense
```
@@ -1952,9 +1952,9 @@ This server accepts configuration via the `settings` key.
Check all targets and tests (will be passed as `--all-targets`)
-- **`rust-analyzer.cargo-watch.arguments`**: `string`
+- **`rust-analyzer.cargo-watch.arguments`**: `array`
- Default: `""`
+ Default: `{}`
`cargo-watch` arguments. (e.g: `--features="shumway,pdf"` will run as `cargo watch -x "check --features="shumway,pdf""` )
@@ -1964,11 +1964,11 @@ This server accepts configuration via the `settings` key.
`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )
-- **`rust-analyzer.cargo-watch.ignore`**: `array`
+- **`rust-analyzer.cargo-watch.enable`**: `boolean`
- Default: `{}`
+ Default: `true`
- A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)
+ Run `cargo check` for diagnostics on save
- **`rust-analyzer.cargoFeatures.allFeatures`**: `boolean`
@@ -1992,12 +1992,6 @@ This server accepts configuration via the `settings` key.
Display additional type information in the editor
-- **`rust-analyzer.enableCargoWatchOnStartup`**: `enum { "ask", "enabled", "disabled" }`
-
- Default: `"ask"`
-
- Whether to run `cargo watch` on startup
-
- **`rust-analyzer.enableEnhancedTyping`**: `boolean`
Default: `true`
@@ -2042,11 +2036,9 @@ This server accepts configuration via the `settings` key.
When highlighting Rust code, use a unique color per identifier
-- **`rust-analyzer.trace.cargo-watch`**: `enum { "off", "error", "verbose" }`
+- **`rust-analyzer.scopeMappings`**: `object`
- Default: `"off"`
-
- Trace output of cargo-watch
+ Mapping Rust Analyzer scopes to TextMateRule scopes list.
- **`rust-analyzer.trace.server`**: `enum { "off", "messages", "verbose" }`
@@ -2389,7 +2381,7 @@ require'nvim_lsp'.texlab.setup{}
https://github.com/theia-ide/typescript-language-server
-`typescript-language-server` can be installed via `:LspInstall tsserver` or by yourself with `npm`:
+`typescript-language-server` can be installed via `:LspInstall tsserver` or by yourself with `npm`:
```sh
npm install -g typescript-language-server
```
diff --git a/lua/nvim_lsp/intelephense.lua b/lua/nvim_lsp/intelephense.lua
index 077c2aaf..3ea18491 100644
--- a/lua/nvim_lsp/intelephense.lua
+++ b/lua/nvim_lsp/intelephense.lua
@@ -39,7 +39,7 @@ skeleton[server_name] = {
description = [[
https://intelephense.com/
-`intelephense` can be installed via `:LspInstall intelephense` or by yourself with `npm`:
+`intelephense` can be installed via `:LspInstall intelephense` or by yourself with `npm`:
```sh
npm install -g intelephense
```
diff --git a/lua/nvim_lsp/pyls.lua b/lua/nvim_lsp/pyls.lua
index 372385bd..1d4c703c 100644
--- a/lua/nvim_lsp/pyls.lua
+++ b/lua/nvim_lsp/pyls.lua
@@ -1,5 +1,4 @@
local skeleton = require 'nvim_lsp/skeleton'
-local util = require 'nvim_lsp/util'
local lsp = vim.lsp
skeleton.pyls = {
diff --git a/lua/nvim_lsp/pyls_ms.lua b/lua/nvim_lsp/pyls_ms.lua
index 6bd42abb..34c2e4a1 100644
--- a/lua/nvim_lsp/pyls_ms.lua
+++ b/lua/nvim_lsp/pyls_ms.lua
@@ -41,12 +41,13 @@ local function make_installer()
system = 'linux'
elseif vim.fn.has('win32') == 1 then
system = 'win'
- else
+ else
error('Unable to identify host operating system')
end
local url = string.format("https://pvsc.azureedge.net/python-language-server-stable/Python-Language-Server-%s-x64.0.5.10.nupkg", string.lower(system))
- download_cmd = string.format('curl -fLo %s --create-dirs %s', install_info.install_dir .. "/pyls.nupkg", url)
+ local download_cmd = string.format('curl -fLo %s --create-dirs %s', install_info.install_dir .. "/pyls.nupkg", url)
+ local install_cmd = ''
if vim.fn.has('mac') == 1 or vim.fn.has('unix') == 1 then
install_cmd = "unzip " .. install_info.install_dir .. "/pyls.nupkg -d " .. install_info.install_dir
@@ -96,9 +97,9 @@ skeleton[name] = {
installer.configure(config)
end;
init_options = {
- interpreter =
+ interpreter =
{
- properties=
+ properties=
{
InterpreterPath=vim.fn.exepath("python");
Version=get_python_version();
diff --git a/lua/nvim_lsp/texlab.lua b/lua/nvim_lsp/texlab.lua
index ab45d872..79ede52c 100644
--- a/lua/nvim_lsp/texlab.lua
+++ b/lua/nvim_lsp/texlab.lua
@@ -22,14 +22,14 @@ end
-- bufnr isn't actually required here, but we need a valid buffer in order to
-- be able to find the client for buf_request.
-- TODO find a client by looking through buffers for a valid client?
-local function build_cancel_all(bufnr)
- bufnr = util.validate_bufnr(bufnr)
- local params = { token = "texlab-build-*" }
- lsp.buf_request(bufnr, 'window/progress/cancel', params, function(err, method, result, client_id)
- if err then error(tostring(err)) end
- print("Cancel result", vim.inspect(result))
- end)
-end
+-- local function build_cancel_all(bufnr)
+-- bufnr = util.validate_bufnr(bufnr)
+-- local params = { token = "texlab-build-*" }
+-- lsp.buf_request(bufnr, 'window/progress/cancel', params, function(err, method, result, client_id)
+-- if err then error(tostring(err)) end
+-- print("Cancel result", vim.inspect(result))
+-- end)
+-- end
skeleton.texlab = {
default_config = {
@@ -49,14 +49,14 @@ skeleton.texlab = {
executable = nil;
onSave = false;
};
- lint = {
- onChange = false;
+ lint = {
+ onChange = false;
};
};
- bibtex = {
- formatting = {
- lineLength = 120
- };
+ bibtex = {
+ formatting = {
+ lineLength = 120
+ };
};
};
};
diff --git a/lua/nvim_lsp/tsserver.lua b/lua/nvim_lsp/tsserver.lua
index 32c289da..75b8bb98 100644
--- a/lua/nvim_lsp/tsserver.lua
+++ b/lua/nvim_lsp/tsserver.lua
@@ -34,7 +34,7 @@ skeleton[server_name] = {
description = [[
https://github.com/theia-ide/typescript-language-server
-`typescript-language-server` can be installed via `:LspInstall tsserver` or by yourself with `npm`:
+`typescript-language-server` can be installed via `:LspInstall tsserver` or by yourself with `npm`:
```sh
npm install -g typescript-language-server
```
diff --git a/lua/nvim_lsp/util.lua b/lua/nvim_lsp/util.lua
index 9c880d85..73d8e6cf 100644
--- a/lua/nvim_lsp/util.lua
+++ b/lua/nvim_lsp/util.lua
@@ -14,23 +14,23 @@ function M.validate_bufnr(bufnr)
return bufnr == 0 and api.nvim_get_current_buf() or bufnr
end
-function M.add_hook_before(fn, new_fn)
- if fn then
+function M.add_hook_before(func, new_fn)
+ if func then
return function(...)
-- TODO which result?
new_fn(...)
- return fn(...)
+ return func(...)
end
else
return new_fn
end
end
-function M.add_hook_after(fn, new_fn)
- if fn then
+function M.add_hook_after(func, new_fn)
+ if func then
return function(...)
-- TODO which result?
- fn(...)
+ func(...)
return new_fn(...)
end
else
@@ -38,10 +38,6 @@ function M.add_hook_after(fn, new_fn)
end
end
-local function split_lines(s)
- return vim.split(s, "\n", true)
-end
-
function M.tbl_deep_extend(dst, ...)
validate { dst = { dst, 't' } }
for i = 1, select("#", ...) do
@@ -247,11 +243,11 @@ function M.server_per_root_dir_manager(make_config)
return manager
end
-function M.search_ancestors(startpath, fn)
- validate { fn = {fn, 'f'} }
- if fn(startpath) then return startpath end
+function M.search_ancestors(startpath, func)
+ validate { func = {func, 'f'} }
+ if func(startpath) then return startpath end
for path in M.path.iterate_parents(startpath) do
- if fn(path) then return path end
+ if func(path) then return path end
end
end
@@ -299,9 +295,9 @@ local function validate_string_list(t)
return true
end
-local function map_list(t, fn)
+local function map_list(t, func)
local res = {}
- for i, v in ipairs(t) do table.insert(res, fn(v, i)) end
+ for i, v in ipairs(t) do table.insert(res, func(v, i)) end
return res
end
@@ -385,6 +381,8 @@ function M.sh(script, cwd)
local stdin = uv.new_pipe(false)
local stdout = uv.new_pipe(false)
local stderr = uv.new_pipe(false)
+
+ -- luacheck: no unused
local handle, pid
handle, pid = uv.spawn("sh", {
stdio = {stdin, stdout, stderr};
diff --git a/lua/nvim_lsp/vimls.lua b/lua/nvim_lsp/vimls.lua
index eaee5216..c16e4fdf 100644
--- a/lua/nvim_lsp/vimls.lua
+++ b/lua/nvim_lsp/vimls.lua
@@ -1,7 +1,6 @@
local skeleton = require "nvim_lsp/skeleton"
local util = require "nvim_lsp/util"
local lsp = vim.lsp
-local api = vim.api
local server_name = "vimls"
local bin_name = "vim-language-server"
diff --git a/scripts/docgen.lua b/scripts/docgen.lua
index 02fdd837..322945b2 100644
--- a/scripts/docgen.lua
+++ b/scripts/docgen.lua
@@ -10,10 +10,10 @@ local function template(s, params)
return (s:gsub("{{([^{}]+)}}", params))
end
-local function map_list(t, fn)
+local function map_list(t, func)
local res = {}
for i, v in ipairs(t) do
- local x = fn(v, i)
+ local x = func(v, i)
if x ~= nil then
table.insert(res, x)
end
@@ -55,11 +55,11 @@ local function readfile(path)
return io.open(path):read("*a")
end
-local function sorted_map_table(t, fn)
+local function sorted_map_table(t, func)
local keys = vim.tbl_keys(t)
table.sort(keys)
return map_list(keys, function(k)
- return fn(k, t[k])
+ return func(k, t[k])
end)
end
@@ -137,7 +137,7 @@ local function make_lsp_sections()
curl -L -o {{vspackage_name}} {{vspackage_url}}
gzip -d {{vspackage_name}}
unzip -j {{vspackage_zip}} extension/package.json
- mv package.json {{package_json_name}}
+ mv package.json {{package_json_name}}
]]
os.execute(template(script, {
package_json_name = package_json_name;
@@ -178,9 +178,9 @@ local function make_lsp_sections()
-- The list of properties.
make_section(0, '\n\n', sorted_map_table(default_settings.properties, function(k, v)
local function tick(s) return string.format("`%s`", s) end
- local function pre(s) return string.format("<pre>%s</pre>", s) end
- local function code(s) return string.format("<code>%s</code>", s) end
local function bold(s) return string.format("**%s**", s) end
+ -- local function pre(s) return string.format("<pre>%s</pre>", s) end
+ -- local function code(s) return string.format("<code>%s</code>", s) end
return make_section(0, '\n', {
"- "..make_section(0, ': ', {
bold(tick(k));