py-requirements extra is now lazyloaded when entering a requirement.txt file

This commit is contained in:
sankalp committed 2024-01-29 17:20:04 +05:45
1 parent e1ab900ac0
commit bc91bbf093
5 files changed
+40 -37

No files matched your search

@@ -1,20 +1,24 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"MeanderingProgrammer/py-requirements.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = function()
require("py-requirements").setup({})
require("nvim-treesitter.configs").setup({
ensure_installed = {
"requirements",
},
})
end,
"MeanderingProgrammer/py-requirements.nvim",
event = {
"BufRead requirements.txt",
},
opts = function(_, opts)
table.insert(opts.sources, { name = "py-requirements" })
dependencies = {
{ "nvim-lua/plenary.nvim" },
{
"hrsh7th/nvim-cmp",
dependencies = {},
opts = function(_, opts)
table.insert(opts.sources, { name = "py-requirements" })
end,
},
},
opts = function()
require("py-requirements").setup({})
require("nvim-treesitter.configs").setup({
ensure_installed = {
"requirements",
},
})
end,
}
@@ -22,10 +22,13 @@ local inlayHints = {
}
local function denoConfigExists()
local root = require("lazyvim.util.root").get() .. "/deno.json"
local configs = { "deno.json", "deno.jsonc" }
local root = require("lazyvim.util.root").get()
if vim.fn.filereadable(root) == 1 then
return true
for _, config in ipairs(configs) do
if vim.fn.filereadable(root .. "/" .. config) == 1 then
return true
end
end
return false
@@ -77,9 +80,7 @@ return {
},
},
},
denols = {
root_dir = require("lspconfig").util.root_pattern("deno.json", "deno.jsonc", "deno.lock"),
},
denols = {},
},
setup = {
tsserver = function(_, opts)
@@ -10,10 +10,7 @@ return {
"neovim/nvim-lspconfig",
opts = {
servers = {
biome = {
root_dir = require("lspconfig").util.root_pattern("biome.json"),
single_file_support = false,
},
biome = {},
},
},
},
@@ -40,7 +37,6 @@ return {
})
opts.formatters = {
cwd = require("conform.util").root_file({ "biome.json" }),
biome = {
condition = function(self, ctx)
return vim.fs.find({ "biome.json" }, { path = ctx.filename, upward = true })[1]
@@ -17,6 +17,7 @@ return {
executeCommandIfExists(":ScrollViewDisable")
executeCommandIfExists(":LspLensOff")
executeCommandIfExists(":NvimContextVtDisable")
executeCommandIfExists(":IBLDisable")
Util.toggle.inlay_hints()
executeCommandIfExists(":Gitsigns toggle_current_line_blame")
end,
@@ -26,6 +27,7 @@ return {
executeCommandIfExists(":ScrollViewEnable")
executeCommandIfExists(":LspLensOn")
executeCommandIfExists(":NvimContextVtEnable")
executeCommandIfExists(":IBLEnable")
Util.toggle.inlay_hints()
executeCommandIfExists(":Gitsigns toggle_current_line_blame")
end,