Skip to content

Commit

Permalink
Merge branch 'LunarVim:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mfauzaan authored Sep 6, 2023
2 parents 7bd4a4e + 15dc529 commit 45e44bf
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 83 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/general-issue-form.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ body:
- type: input
id: nvim-version
attributes:
label: Neovim version (>= 0.9.0)
label: Neovim version (>= 0.9.1)
description: "Output of `nvim --version`"
placeholder: |
NVIM v0.9.0-dev-983+g6dfabd014
NVIM v0.10.0-dev-670+g2ecba65b4
validations:
required: true
- type: input
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/lsp-issue-form.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ body:
- type: input
id: nvim-version
attributes:
label: Neovim version (>= 0.9.0)
label: Neovim version (>= 0.9.1)
description: "Output of `nvim --version`"
placeholder: |
NVIM v0.9.0-dev-983+g6dfabd014
NVIM v0.10.0-dev-670+g2ecba65b4
validations:
required: true
- type: input
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
include:
- runner: ubuntu-latest
os: linux
neovim: v0.9.0
neovim: v0.9.1
- runner: macos-latest
os: osx
neovim: v0.9.0
neovim: v0.9.1
- runner: ubuntu-22.04
os: linux
neovim: nightly
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.9.0
version: v0.9.1

- name: Install LunarVim
timeout-minutes: 4
Expand Down
2 changes: 1 addition & 1 deletion lua/lvim/core/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function M.load_defaults()
local buftype = vim.api.nvim_get_option_value("buftype", { buf = args.buf })
if not (vim.fn.expand "%" == "" or buftype == "nofile") then
vim.api.nvim_del_augroup_by_name "_file_opened"
vim.cmd "do User FileOpened"
vim.api.nvim_exec_autocmds("User", { pattern = "FileOpened" })
require("lvim.lsp").setup()
end
end,
Expand Down
1 change: 0 additions & 1 deletion lua/lvim/core/nvimtree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function M.config()
reload_on_bufenter = false,
respect_buf_cwd = false,
on_attach = "default",
remove_keymaps = false,
select_prompts = false,
view = {
adaptive_size = false,
Expand Down
2 changes: 1 addition & 1 deletion lua/lvim/lsp/manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ end
-- manually start the server and don't wait for the usual filetype trigger from lspconfig
local function buf_try_add(server_name, bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
require("lspconfig")[server_name].manager.try_add_wrapper(bufnr)
require("lspconfig")[server_name].manager:try_add_wrapper(bufnr)
end

-- check if the manager autocomd has already been configured since some servers can take a while to initialize
Expand Down
3 changes: 3 additions & 0 deletions lua/lvim/lsp/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ end
---@param filter { filetype: string | string[] }?: (optional) Used to filter the list of server names.
---@return string[] list of names of supported servers
function M.get_supported_servers(filter)
-- force synchronous mode, see: |mason-registry.refresh()|
require("mason-registry").refresh()
require("mason-registry").get_all_packages()

local _, supported_servers = pcall(function()
return require("mason-lspconfig").get_available_servers(filter)
end)
Expand Down
42 changes: 21 additions & 21 deletions snapshots/default.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"Comment.nvim": {
"commit": "d0cbbfb"
"commit": "0236521"
},
"LuaSnip": {
"commit": "99a94cc"
"commit": "c4d6298"
},
"alpha-nvim": {
"commit": "e4fc5e2"
"commit": "7a6b948"
},
"bigfile.nvim": {
"commit": "9616b73"
},
"bufferline.nvim": {
"commit": "99f0932"
"commit": "417b303"
},
"cmp-buffer": {
"commit": "3022dbc"
Expand All @@ -30,13 +30,13 @@
"commit": "1809552"
},
"friendly-snippets": {
"commit": "bc38057"
"commit": "377d454"
},
"gitsigns.nvim": {
"commit": "5d73da7"
"commit": "749267a"
},
"indent-blankline.nvim": {
"commit": "4541d69"
"commit": "9637670"
},
"lazy.nvim": {
"commit": "3ad55ae"
Expand All @@ -51,49 +51,49 @@
"commit": "08bbc93"
},
"mason-lspconfig.nvim": {
"commit": "e86a4c8"
"commit": "2997f46"
},
"mason.nvim": {
"commit": "fe9e34a"
"commit": "a51c2d0"
},
"neodev.nvim": {
"commit": "9f0205a"
"commit": "3de41fe"
},
"nlsp-settings.nvim": {
"commit": "64976a5"
"commit": "2a52e79"
},
"null-ls.nvim": {
"commit": "db09b6c"
"commit": "0010ea9"
},
"nvim-autopairs": {
"commit": "ae5b41c"
},
"nvim-cmp": {
"commit": "c4e491a"
"commit": "51f1e11"
},
"nvim-dap": {
"commit": "1c63f37"
"commit": "4377a05"
},
"nvim-dap-ui": {
"commit": "85b16ac"
},
"nvim-lspconfig": {
"commit": "c0de180"
"commit": "f7922e5"
},
"nvim-navic": {
"commit": "9c89730"
},
"nvim-tree.lua": {
"commit": "0a89dcb"
"commit": "920868d"
},
"nvim-treesitter": {
"commit": "8d5e5dc"
"commit": "31f608e"
},
"nvim-ts-context-commentstring": {
"commit": "e9062e2"
"commit": "9bff161"
},
"nvim-web-devicons": {
"commit": "efbfed0"
"commit": "cfc8824"
},
"onedarker.nvim": {
"commit": "b4f92f0"
Expand All @@ -105,7 +105,7 @@
"commit": "8c6bad7"
},
"schemastore.nvim": {
"commit": "787ffac"
"commit": "c7c6353"
},
"structlog.nvim": {
"commit": "45b26a2"
Expand All @@ -123,7 +123,7 @@
"commit": "1ee1101"
},
"vim-illuminate": {
"commit": "5ed1758"
"commit": "76f28e8"
},
"which-key.nvim": {
"commit": "7ccf476"
Expand Down
16 changes: 1 addition & 15 deletions tests/lvim/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,14 @@ function M.search_file(file, args)
local stdout, ret = Job:new({
command = "grep",
args = { args, file },
cwd = get_cache_dir(),
cwd = vim.loop.cwd(),
on_stderr = function(_, data)
table.insert(stderr, data)
end,
}):sync()
return ret, stdout, stderr
end

function M.file_contains(file, query)
local ret, stdout, stderr = M.search_file(file, query)
if ret == 0 then
return true
end
if not vim.tbl_isempty(stderr) then
error(vim.inspect(stderr))
end
if not vim.tbl_isempty(stdout) then
error(vim.inspect(stdout))
end
return false
end

function M.log_contains(query)
local logfile = require("lvim.core.log"):get_path()
local ret, stdout, stderr = M.search_file(logfile, query)
Expand Down
33 changes: 24 additions & 9 deletions tests/specs/bootstrap_spec.lua
Original file line number Diff line number Diff line change
@@ -1,39 +1,54 @@
local a = require "plenary.async_lib.tests"
local uv = vim.loop
local home_dir = uv.os_homedir()

a.describe("initial start", function()
describe("initial start", function()
before_each(function()
vim.cmd [[
let v:errmsg = ""
let v:errors = []
]]
end)

after_each(function()
local errmsg = vim.fn.eval "v:errmsg"
local exception = vim.fn.eval "v:exception"
local errors = vim.fn.eval "v:errors"
assert.equal("", errmsg)
assert.equal("", exception)
assert.True(vim.tbl_isempty(errors))
end)

local lvim_config_path = get_config_dir()
local lvim_runtime_path = get_runtime_dir()
local lvim_cache_path = get_cache_dir()

a.it("should be able to detect test environment", function()
it("should be able to detect test environment", function()
assert.truthy(os.getenv "LVIM_TEST_ENV")
assert.falsy(package.loaded["lvim.impatient"])
end)

a.it("should be able to use lunarvim cache directory using vim.fn", function()
it("should be able to use lunarvim cache directory using vim.fn", function()
assert.equal(lvim_cache_path, vim.fn.stdpath "cache")
end)

a.it("should be to retrieve default neovim directories", function()
it("should be to retrieve default neovim directories", function()
local xdg_config = os.getenv "XDG_CONFIG_HOME" or join_paths(home_dir, ".config")
assert.equal(join_paths(xdg_config, "nvim"), vim.call("stdpath", "config"))
end)

a.it("should be able to read lunarvim directories", function()
it("should be able to read lunarvim directories", function()
local rtp_list = vim.opt.rtp:get()
assert.truthy(vim.tbl_contains(rtp_list, lvim_runtime_path .. "/lvim"))
assert.truthy(vim.tbl_contains(rtp_list, lvim_config_path))
end)

a.it("should be able to run treesitter without errors", function()
it("should be able to run treesitter without errors", function()
assert.truthy(vim.treesitter.highlighter.active)
end)

a.it("should be able to pass basic checkhealth without errors", function()
it("should be able to pass basic checkhealth without errors", function()
vim.cmd "set cmdheight&"
vim.cmd "checkhealth nvim"
vim.cmd "silent checkhealth nvim"
local errmsg = vim.fn.eval "v:errmsg"
local exception = vim.fn.eval "v:exception"
assert.equal("", errmsg) -- v:errmsg was not updated.
Expand Down
15 changes: 7 additions & 8 deletions tests/specs/config_loader_spec.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
local a = require "plenary.async_lib.tests"
local config = require "lvim.config"
local fmt = string.format

a.describe("config-loader", function()
describe("config-loader", function()
local user_config_path = join_paths(get_config_dir(), "config.lua")
local default_config_path = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua")

Expand All @@ -23,15 +22,15 @@ a.describe("config-loader", function()
assert.True(vim.tbl_isempty(errors))
end)

a.it("should be able to find user-config", function()
it("should be able to find user-config", function()
assert.equal(user_config_path, get_config_dir() .. "/config.lua")
end)

a.it("should be able to load user-config without errors", function()
it("should be able to load user-config without errors", function()
config:load(user_config_path)
end)

a.it("should be able to reload user-config without errors", function()
it("should be able to reload user-config without errors", function()
config:load(user_config_path)
local test_path = "/tmp/lvim"
os.execute(string.format([[echo "vim.opt.undodir = '%s'" >> %s]], test_path, user_config_path))
Expand All @@ -41,15 +40,15 @@ a.describe("config-loader", function()
end)
end)

a.it("should not get interrupted by errors in user-config", function()
it("should not get interrupted by errors in user-config", function()
local test_path = "/tmp/lunarvim"
os.execute(string.format([[echo "vim.opt.undodir = '%s'" >> %s]], test_path, user_config_path))
config:load(user_config_path)
assert.equal(vim.opt.undodir:get()[1], test_path)
require("lvim.core.log"):set_level "error"
os.execute(string.format("echo 'invalid_function()' >> %s", user_config_path))
lvim.log.level = "error"
os.execute(string.format("echo 'ignore_me()' >> %s", user_config_path))
config:load(user_config_path)
require("lvim.core.log"):set_level "error"
assert.equal(vim.opt.undodir:get()[1], test_path)
end)
end)
Loading

0 comments on commit 45e44bf

Please sign in to comment.