feat(nvim): LSP, completion, linting, formatting for Dotnet, JSON,

markdown, SQL
This commit is contained in:
Pratik Tripathy
2024-12-28 16:48:50 +05:30
parent 11a166080f
commit 3fd3aa04f5
7 changed files with 126 additions and 9 deletions

View File

@@ -57,6 +57,27 @@ return {
nerd_font_variant = "mono",
},
completion = {
accept = {
-- experimental auto-brackets support
auto_brackets = {
enabled = true,
},
},
menu = {
draw = {
treesitter = { "lsp" },
},
},
documentation = {
auto_show = true,
auto_show_delay_ms = 200,
},
ghost_text = {
enabled = vim.g.ai_cmp,
},
},
signature = { enabled = true },
-- This comes from the luasnip extra, if you don't add it, won't be able to
@@ -85,6 +106,7 @@ return {
"luasnip",
"path",
"codeium",
"markdown",
},
cmdline = {},
@@ -114,6 +136,10 @@ return {
module = "blink.compat.source",
score_offset = 1200,
},
markdown = {
name = "RenderMarkdown",
module = "render-markdown.integ.blink",
},
},
},
},

View File

@@ -12,8 +12,20 @@ return {
{ "kristijanhusak/vim-dadbod-completion" },
},
config = function()
vim.g.db_ui_save_location = vim.fn.stdpath("config") .. require("plenary.path").path.sep .. "db_ui"
vim.g.db_ui_use_nerd_fonts = 1
local data_path = vim.fn.stdpath("data")
vim.g.db_ui_auto_execute_table_helpers = 1
vim.g.db_ui_save_location = data_path .. "/db_ui"
vim.g.db_ui_show_database_icon = true
vim.g.db_ui_tmp_query_location = data_path .. "/db_ui/tmp"
vim.g.db_ui_use_nerd_fonts = true
vim.g.db_ui_use_nvim_notify = true
-- NOTE: The default behavior of auto-execution of queries on save is disabled
-- this is useful when you have a big query that you don't want to run every time
-- you save the file running those queries can crash neovim to run use the
-- default keymap: <leader>S
vim.g.db_ui_execute_on_save = false
vim.api.nvim_create_autocmd("FileType", {
pattern = {
@@ -40,4 +52,11 @@ return {
{ "<leader>qf", "<cmd>DBUIFindBuffer<cr>", desc = "DB: Find Connection" },
},
},
{
"kristijanhusak/vim-dadbod-ui",
cmd = { "DBUI", "DBUIToggle", "DBUIAddConnection", "DBUIFindBuffer" },
dependencies = "vim-dadbod",
init = function() end,
},
}

View File

@@ -6,6 +6,7 @@ return {
event = { "BufWritePre" },
opts = {
formatters_by_ft = {
cs = { "csharpier" },
javascript = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
@@ -59,6 +60,10 @@ return {
"-gitignore_excludes",
},
},
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
},

View File

@@ -486,7 +486,7 @@ return {
"bash",
"html",
"css",
"json",
"json5",
"yaml",
},

View File

@@ -119,7 +119,21 @@ return {
filetypes = { "html", "twig", "hbs" },
},
cssls = {},
jsonls = {},
jsonls = {
-- lazy-load schemastore when needed
on_new_config = function(new_config)
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
end,
settings = {
json = {
format = {
enable = true,
},
validate = { enable = true },
},
},
},
bashls = { filetypes = { "sh", "bash", "zsh" } },
pylsp = {},
@@ -136,11 +150,16 @@ return {
},
omnisharp = {
cmd = { "omnisharp" },
enable_editorconfig_support = true,
enable_ms_build_load_projects_on_demand = false,
handlers = {
["textDocument/definition"] = function(...)
return require("omnisharp_extended").handler(...)
end,
},
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
enable_editorconfig_support = true,
enable_ms_build_load_projects_on_demand = false,
analyze_open_documents_only = false,
settings = {
dotnet = {
@@ -164,6 +183,8 @@ return {
ts_ls = {
settings = {
typescript = {
updateImportOnFileMove = { enabled = "always" },
suggest = { completeFunctionCalls = true },
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
@@ -231,6 +252,8 @@ return {
"css-lsp",
"dockerfile-language-server",
"python-lsp-server",
"csharpier",
"netcoredbg",
})
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })

View File

@@ -1,3 +1,3 @@
return {
-- { "OmniSharp/omnisharp-vim" },
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
}

View File

@@ -19,6 +19,50 @@ return {
{ "machakann/vim-highlightedyank" },
-- Render Markdown on Neovim
{
"MeanderingProgrammer/render-markdown.nvim",
opts = {
code = {
sign = false,
width = "block",
border = "thick",
position = "right",
language_name = false,
right_pad = 1,
},
heading = {
sign = false,
icons = {},
},
pipe_table = {
preset = "round",
},
indent = {
enabled = true,
skip_heading = true,
},
},
ft = { "markdown", "norg", "rmd", "org" },
config = function(_, opts)
require("render-markdown").setup(opts)
Snacks.toggle({
name = "Render Markdown",
get = function()
return require("render-markdown.state").enabled
end,
set = function(enabled)
local m = require("render-markdown")
if enabled then
m.enable()
else
m.disable()
end
end,
}):map("<leader>cM")
end,
},
-- colorscheme
{
"projekt0n/github-nvim-theme",