neotest update

This commit is contained in:
Zoe Roux
2022-09-07 04:59:08 +02:00
parent a62ec798f5
commit 7b993caa53
10 changed files with 134 additions and 29 deletions

View File

@@ -39,6 +39,8 @@ ttf-liberation
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
ttf-roboto
ttf-roboto-mono
# Japanese
fcitx5

View File

@@ -1,5 +1,4 @@
prefix=${XDG_DATA_HOME}/npm
cache=${XDG_CACHE_HOME}/npm
tmp=${XDG_RUNTIME_DIR}/npm
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js

Submodule dwm/dwm updated: c32d53ad76...1996a3be2a

View File

@@ -1 +1,2 @@
plugin/
spell/*.spl

View File

@@ -9,3 +9,7 @@ catch /^Vim\%((\a\+)\)\=:E185/
set background=dark
endtry
]]
vim.cmd [[
hi link LspComment Comment
]]

View File

@@ -22,6 +22,19 @@ M.setup = function()
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
local ok, inlay = pcall(require, "lsp-inlayhints")
if ok then
inlay.setup()
end
local shok, sh = pcall(require, "nvim-semantic-tokens")
if shok then
sh.setup {
preset = "default",
highlighters = { require 'nvim-semantic-tokens.table-highlighter' }
}
end
end
local function lsp_highlight_document(client)
@@ -49,7 +62,7 @@ wk.register({
})
function _LSP_FORMAT_FILTER(client)
local clients = vim.lsp.get_active_clients({bufnr = 0})
local clients = vim.lsp.get_active_clients({ bufnr = 0 })
for _, c in pairs(clients) do
if c.name == "null-ls" and c.server_capabilities.documentFormattingProvider then
return client.name == "null-ls"
@@ -92,11 +105,20 @@ local lsp_codelens = function()
-- vim.cmd [[ autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh() ]]
end
local lsp_semhighlight = function(client)
local caps = client.server_capabilities
if caps.semanticTokensProvider and caps.semanticTokensProvider.full then
vim.cmd [[autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.buf.semantic_tokens_full()]]
end
end
M.on_attach = function(client, bufnr)
lsp_keymaps(bufnr)
lsp_highlight_document(client)
lsp_codelens()
lsp_semhighlight(client)
require("lsp-inlayhints").on_attach(bufnr, client)
require "nvim-navic".attach(client, bufnr)
end

View File

@@ -29,6 +29,8 @@ lsp_installer.setup({
}
})
local servers = {}
lspconfig.omnisharp.setup({
handlers = {
["textDocument/definition"] = require('omnisharp_extended').handler,
@@ -41,11 +43,13 @@ lspconfig.omnisharp.setup({
["OMNISHARP_msbuild:EnablePackageAutoRestore"] = true,
},
})
table.insert(servers, "omnisharp")
lspconfig.jsonls.setup({
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = { enable = true },
},
},
})
@@ -66,6 +70,7 @@ lspconfig.sumneko_lua.setup({
},
},
})
table.insert(servers, "sumneko_lua")
lspconfig.robotframework_ls.setup({
settings = {
@@ -77,6 +82,7 @@ lspconfig.robotframework_ls.setup({
},
}
})
table.insert(servers, "robotframework_ls")
lspconfig.ltex.setup({
settings = {
@@ -87,7 +93,47 @@ lspconfig.ltex.setup({
},
},
})
table.insert(servers, "ltex")
lspconfig.tsserver.setup({
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
}
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
}
}
}
})
table.insert(servers, "tsserver")
local function contains(table, val)
for i = 1, #table do
if table[i] == val then
return true
end
end
return false
end
for _, server in ipairs(lsp_installer.get_installed_servers()) do
lspconfig[server.name].setup({})
if not contains(servers, server.name) then
lspconfig[server.name].setup({})
end
end

View File

@@ -100,6 +100,8 @@ return packer.startup(function(use)
use({ 'scalameta/nvim-metals', requires = { "nvim-lua/plenary.nvim" } })
use "b0o/schemastore.nvim"
use "jose-elias-alvarez/null-ls.nvim"
use "lvimuser/lsp-inlayhints.nvim"
use "theHamsta/nvim-semantic-tokens"
use {
"hrsh7th/cmp-nvim-lsp",
@@ -137,7 +139,16 @@ return packer.startup(function(use)
-- use "nvim-telescope/telescope-dap.nvim"
use { "rcarriga/vim-ultest", requires = { "vim-test/vim-test" }, run = ":UpdateRemotePlugins" }
use {
"nvim-neotest/neotest",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim"
}
}
use { "nvim-neotest/neotest-python" }
use { "nvim-neotest/neotest-vim-test", requires = { "vim-test/vim-test" } }
use { "lukas-reineke/virt-column.nvim", config = function() require("virt-column").setup() end }

View File

@@ -1,38 +1,58 @@
local ok, neotest = pcall(require, "neotest")
if not ok then
return
end
neotest.setup({
adapters = {
require("neotest-python")({
dap = { justMyCode = false },
}),
require("neotest-vim-test")({
ignore_file_types = { "python" },
}),
},
icons = {
failed = "",
passed = "",
running = "",
skipped = "",
unknown = ""
},
strategies = {
integrated = {
height = 180,
width = 180,
}
},
})
vim.g["test#csharp#runner"] = 'dotnettest'
vim.g["ultest_pass_sign"] = ""
vim.g["ultest_fail_sign"] = ""
vim.g["ultest_running_sign"] = ""
vim.g["ultest_not_run_sign"] = ""
vim.g["ultest_output_max_width"] = 180
vim.g["ultest_output_min_width"] = 180
vim.g["ultest_use_pty"] = 1
vim.cmd [[
augroup test_output
autocmd!
autocmd FileType UltestSummary setl nolist
augroup end
]]
--[[ vim.cmd [[ ]]
--[[ augroup test_output ]]
--[[ autocmd! ]]
--[[ autocmd FileType UltestSummary setl nolist ]]
--[[ augroup end ]]
--[[ ] ] ]]
local wk = require("which-key")
wk.register({
u = {
name = "Unit Tests",
r = { "<Plug>(ultest-run-nearest)", "Run nearest" },
o = { "<Plug>(ultest-output-show)", "Show test output" },
j = { "<Plug>(ultest-output-jump)", "Jump to test output" },
a = { "<Plug>(ultest-attach)", "Attach to the nearest running test" },
s = { "<Plug>(ultest-stop-nearest)", "Stop the nearest test" },
t = { "<cmd>UltestSummary!<cr>", "Toggle the test window" },
r = { 'lua require("neotest").run.run()', "Run nearest" },
d = { 'lua require("neotest").run.run({strategy = "dap"})', "Debug nearest" },
o = { 'lua require("neotest").output.open({ enter = true })', "Show test output" },
a = { 'lua require("neotest").run.attach()', "Attach to the nearest running test" },
s = { 'lua require("neotest").run.stop()', "Stop the nearest test" },
t = { 'lua require("neotest").summary.toggle()', "Toggle the test window" },
},
}, {
prefix = "<leader>",
})
wk.register({
["[u"] = { "<Plug>(ultest-prev-fail)", "Prev failing test" },
["]u"] = { "<Plug>(ultest-next-fail)", "Next failing test" },
["[u"] = { 'lua require("neotest").jump.prev({ status = "failed" })', "Prev failing test" },
["]u"] = { 'lua require("neotest").jump.next({ status = "failed" })', "Next failing test" },
})