From 5190c45dafd559a8bc4e0d58030708da3faefa8e Mon Sep 17 00:00:00 2001 From: voidarclabs Date: Thu, 21 Aug 2025 19:14:34 +0100 Subject: [PATCH] telescope, rebuild incoming --- lua/plugins/correction.lua | 264 +++++++++++++++++++------------------ lua/plugins/telescope.lua | 4 + 2 files changed, 141 insertions(+), 127 deletions(-) create mode 100644 lua/plugins/telescope.lua diff --git a/lua/plugins/correction.lua b/lua/plugins/correction.lua index c239d29..e42c11c 100644 --- a/lua/plugins/correction.lua +++ b/lua/plugins/correction.lua @@ -1,137 +1,147 @@ return { - -- LSP Configuration - { - "neovim/nvim-lspconfig", - dependencies = { - "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", - }, - config = function() - require("mason").setup() - require("mason-lspconfig").setup({ - ensure_installed = { "ts_ls", "lua_ls", "pyright", "rust_analyzer", "eslint" }, -- Add your desired LSPs - automatic_installation = true, - }) + -- LSP Configuration + { + "neovim/nvim-lspconfig", + dependencies = { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", + }, + config = function() + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = { "ts_ls", "lua_ls", "pyright", "rust_analyzer", "eslint" }, -- Add your desired LSPs + automatic_installation = true, + }) - local lspconfig = require("lspconfig") - lspconfig.lua_ls.setup({}) - --Enable (broadcasting) snippet capability for completion - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities.textDocument.completion.completionItem.snippetSupport = true + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup({}) + --Enable (broadcasting) snippet capability for completion + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.completion.completionItem.snippetSupport = true - vim.lsp.config("cssls", { - capabilities = capabilities, - }) - lspconfig.pyright.setup({}) - lspconfig.cssls.setup({}) - lspconfig.ts_ls.setup({ - capabilities = capabilities, - }) - lspconfig.rust_analyzer.setup({}) - lspconfig.emmet_ls.setup({ - capabilities = require("cmp_nvim_lsp").default_capabilities(), - filetypes = { "html", "css", "javascriptreact", "typescriptreact" }, -- Add more if needed - init_options = { - html = { - options = { - ["bem.enabled"] = true, - }, - }, - }, - }) - end, - }, + vim.lsp.config("qmlls", { + default_config = { + cmd = { "qmlls" }, + filetypes = { "qml" }, + root_dir = lspconfig.util.root_pattern(".git", "."), + } + } - -- Autocompletion - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", -- Completion for snippets - }, - config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") + ) + vim.lsp.config("cssls", { + capabilities = capabilities, + }) + lspconfig.pyright.setup({}) + lspconfig.cssls.setup({}) + lspconfig.qmlls.setup({}) + lspconfig.ts_ls.setup({ + capabilities = capabilities, + }) + lspconfig.rust_analyzer.setup({}) + lspconfig.emmet_ls.setup({ + capabilities = require("cmp_nvim_lsp").default_capabilities(), + filetypes = { "html", "css", "javascriptreact", "typescriptreact" }, -- Add more if needed + init_options = { + html = { + options = { + ["bem.enabled"] = true, + }, + }, + }, + }) + end, +}, - cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping.confirm({ select = true }), -- Confirm selection with Enter - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, -- This should provide LSP completions like for ESLint - -- { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }), - }) - end, - }, +-- Autocompletion +{ + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", -- Completion for snippets + }, + config = function() + local cmp = require("cmp") + local luasnip = require("luasnip") - -- Linting - { - "mfussenegger/nvim-lint", - config = function() - local lint = require("lint") + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping.confirm({ select = true }), -- Confirm selection with Enter + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, -- This should provide LSP completions like for ESLint + -- { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }), + }) + end, +}, - -- Explicitly define linters for each file type (without ast_grep) - lint.linters_by_ft = { - python = { "flake8" }, - javascript = { "eslint" }, - typescript = { "eslint" }, - } +-- Linting +{ + "mfussenegger/nvim-lint", + config = function() + local lint = require("lint") - -- Auto-run the linter only for the configured filetypes - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = "!*.lua", - callback = function() - local ft = vim.bo.filetype - if lint.linters_by_ft[ft] then - lint.try_lint() - end - end, - }) - end, - }, + -- Explicitly define linters for each file type (without ast_grep) + lint.linters_by_ft = { + python = { "flake8" }, + javascript = { "eslint" }, + typescript = { "eslint" }, + } - -- autoformatting - { - "stevearc/conform.nvim", - config = function() - require("conform").setup({ - formatters_by_ft = { - lua = { "stylua" }, - javascript = { "prettier" }, - python = { "black" }, - }, - format_on_save = true, - }) - end, - }, + -- Auto-run the linter only for the configured filetypes + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "!*.lua", + callback = function() + local ft = vim.bo.filetype + if lint.linters_by_ft[ft] then + lint.try_lint() + end + end, + }) + end, +}, + +-- autoformatting +{ + "stevearc/conform.nvim", + config = function() + require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + javascript = { "prettier" }, + python = { "black" }, + }, + format_on_save = true, + }) + end, +}, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..f3e803f --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,4 @@ +return { + 'nvim-telescope/telescope.nvim', + dependencies = { 'nvim-lua/plenary.nvim' } +}