Updated config
This commit is contained in:
20
.emmyrc.json
Normal file
20
.emmyrc.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json",
|
||||||
|
"runtime": {
|
||||||
|
"version": "LuaJIT",
|
||||||
|
"requirePattern": [
|
||||||
|
"lua/?.lua",
|
||||||
|
"lua/?/init.lua",
|
||||||
|
"?/lua/?.lua",
|
||||||
|
"?/lua/?/init.lua"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"workspace": {
|
||||||
|
"library": [
|
||||||
|
"$VIMRUNTIME",
|
||||||
|
"$HOME/.local/share/nvim/lazy/luvit-meta",
|
||||||
|
"$HOME/.local/share/nvim/lazy/lazy.nvim"
|
||||||
|
],
|
||||||
|
"ignoreGlobs": ["**/*_spec.lua"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,9 +13,8 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
require("lspconfig")
|
require("lspconfig")
|
||||||
local tserrortranslator = require("ts-error-translator")
|
local tserrortranslator = require("ts-error-translator")
|
||||||
local util = require("lspconfig.util")
|
|
||||||
local on_attach = require("taken.utils.on_attach")
|
local on_attach = require("taken.utils.on_attach")
|
||||||
local path = util.path
|
local get_python_path = require("taken.utils.lsp").get_python_path
|
||||||
|
|
||||||
-- local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
-- local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
-- local capabilities = cmp_nvim_lsp.default_capabilities()
|
-- local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
@@ -23,11 +22,26 @@ return {
|
|||||||
local blink = require("blink.cmp")
|
local blink = require("blink.cmp")
|
||||||
local capabilities = blink.get_lsp_capabilities()
|
local capabilities = blink.get_lsp_capabilities()
|
||||||
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " }
|
vim.diagnostic.config({
|
||||||
for type, icon in pairs(signs) do
|
signs = {
|
||||||
local hl = "DiagnosticSign" .. type
|
[vim.diagnostic.severity.ERROR] = " ",
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
[vim.diagnostic.severity.WARN] = " ",
|
||||||
end
|
[vim.diagnostic.severity.HINT] = "ﴞ ",
|
||||||
|
[vim.diagnostic.severity.INFO] = " ",
|
||||||
|
},
|
||||||
|
-- linehl = {
|
||||||
|
-- [vim.diagnostic.severity.ERROR] = "DiagnosticSignError",
|
||||||
|
-- [vim.diagnostic.severity.WARN] = "DiagnosticSignWarn",
|
||||||
|
-- [vim.diagnostic.severity.HINT] = "DiagnosticSignHint",
|
||||||
|
-- [vim.diagnostic.severity.INFO] = "DiagnosticSignInfo",
|
||||||
|
-- },
|
||||||
|
-- numhl = {
|
||||||
|
-- [vim.diagnostic.severity.ERROR] = "DiagnosticSignError",
|
||||||
|
-- [vim.diagnostic.severity.WARN] = "DiagnosticSignWarn",
|
||||||
|
-- [vim.diagnostic.severity.HINT] = "DiagnosticSignHint",
|
||||||
|
-- [vim.diagnostic.severity.INFO] = "DiagnosticSignInfo",
|
||||||
|
-- },
|
||||||
|
})
|
||||||
|
|
||||||
local defaultLsps = {
|
local defaultLsps = {
|
||||||
"html",
|
"html",
|
||||||
@@ -45,6 +59,11 @@ return {
|
|||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- vim.lsp.config("emmylua_ls", {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- on_attach = on_attach,
|
||||||
|
-- })
|
||||||
|
|
||||||
-- lua
|
-- lua
|
||||||
vim.lsp.config("lua_ls", {
|
vim.lsp.config("lua_ls", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
@@ -70,23 +89,6 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local function get_python_path(workspace)
|
|
||||||
-- Use activated virtualenv.
|
|
||||||
if vim.env.VIRTUAL_ENV then
|
|
||||||
return path.join(vim.env.VIRTUAL_ENV, "bin", "python")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Find and use virtualenv in workspace directory.
|
|
||||||
for _, pattern in ipairs({ "*", ".*" }) do
|
|
||||||
local match = vim.fn.glob(path.join(workspace, pattern, "pyvenv.cfg"))
|
|
||||||
if match ~= "" then
|
|
||||||
return path.join(path.dirname(match), "bin", "python")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- python
|
-- python
|
||||||
vim.lsp.config("pyright", {
|
vim.lsp.config("pyright", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
@@ -140,10 +142,13 @@ return {
|
|||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.enable(defaultLsps)
|
vim.lsp.enable(defaultLsps)
|
||||||
vim.lsp.enable("lua_ls")
|
vim.lsp.enable({
|
||||||
vim.lsp.enable("pyright")
|
"lua_ls",
|
||||||
vim.lsp.enable("ts_ls")
|
-- "emmylua_ls",
|
||||||
vim.lsp.enable("powershell_es")
|
"pyright",
|
||||||
|
"ts_ls",
|
||||||
|
"powershell_es",
|
||||||
|
})
|
||||||
|
|
||||||
tserrortranslator.setup()
|
tserrortranslator.setup()
|
||||||
end,
|
end,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ return {
|
|||||||
"tailwindcss",
|
"tailwindcss",
|
||||||
"marksman",
|
"marksman",
|
||||||
"eslint",
|
"eslint",
|
||||||
|
"emmylua_ls",
|
||||||
},
|
},
|
||||||
automatic_installation = true,
|
automatic_installation = true,
|
||||||
})
|
})
|
||||||
|
|||||||
23
lua/taken/utils/lsp.lua
Normal file
23
lua/taken/utils/lsp.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
local util = require("lspconfig.util")
|
||||||
|
local path = util.path
|
||||||
|
|
||||||
|
M.get_python_path = function(workspace)
|
||||||
|
-- Use activated virtualenv.
|
||||||
|
if vim.env.VIRTUAL_ENV then
|
||||||
|
return path.join(vim.env.VIRTUAL_ENV, "bin", "python")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find and use virtualenv in workspace directory.
|
||||||
|
for _, pattern in ipairs({ "*", ".*" }) do
|
||||||
|
local match = vim.fn.glob(path.join(workspace, pattern, "pyvenv.cfg"))
|
||||||
|
if match ~= "" then
|
||||||
|
return path.join(path.dirname(match), "bin", "python")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
Reference in New Issue
Block a user