Skip to content

Commit

Permalink
fix: properly check for global vim and configure luacheck
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 9, 2022
1 parent edc8a1f commit 92b5425
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ cache = true
ignore = {
"631", -- max_line_length
"212/_.*", -- unused argument, for vars with "_" prefix
"121", -- setting read-only global variable 'vim'
"122", -- setting read-only field of global variable 'vim'
}

-- Global objects defined by the C code
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/_editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
-- - https://github.com/bakpakin/Fennel (pretty print, repl)
-- - https://github.com/howl-editor/howl/tree/master/lib/howl/util

local vim = assert(vim)
vim = assert(vim)

-- These are for loading runtime modules lazily since they aren't available in
-- the nvim binary as specified in executor.c
Expand Down
3 changes: 1 addition & 2 deletions runtime/lua/vim/_init_packages.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-- prevents luacheck from making lints for setting things on vim
local vim = assert(vim)
vim = assert(vim)

local pathtrails = {}
vim._so_trails = {}
Expand Down
3 changes: 1 addition & 2 deletions runtime/lua/vim/_meta.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-- prevents luacheck from making lints for setting things on vim
local vim = assert(vim)
vim = assert(vim)

local a = vim.api

Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local protocol = require('vim.lsp.protocol')
local util = require('vim.lsp.util')
local sync = require('vim.lsp.sync')

local vim = vim
vim = assert(vim)
local api = vim.api
local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_buf_get_option, nvim_exec_autocmds =
api.nvim_err_writeln,
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp/buf.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local vim = vim
vim = assert(vim)
local api = vim.api
local validate = vim.validate
local util = require('vim.lsp.util')
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp/handlers.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local log = require('vim.lsp.log')
local protocol = require('vim.lsp.protocol')
local util = require('vim.lsp.util')
local vim = vim
vim = assert(vim)
local api = vim.api

local M = {}
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp/rpc.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local vim = vim
vim = assert(vim)
local uv = vim.loop
local log = require('vim.lsp.log')
local protocol = require('vim.lsp.protocol')
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/lsp/util.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local protocol = require('vim.lsp.protocol')
local snippet = require('vim.lsp._snippet')
local vim = vim
vim = assert(vim)
local validate = vim.validate
local api = vim.api
local list_extend = vim.list_extend
Expand Down
2 changes: 1 addition & 1 deletion runtime/lua/vim/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-- or the test suite. (Eventually the test suite will be run in a worker process,
-- so this wouldn't be a separate case to consider)

local vim = vim or {}
vim = assert(vim)

--- Returns a deep copy of the given object. Non-table objects are copied as
--- in a typical Lua assignment, whereas table objects are copied recursively.
Expand Down

0 comments on commit 92b5425

Please sign in to comment.