diff --git a/modules/home-manager/programs/neovim/default.nix b/modules/home-manager/programs/neovim/default.nix index 79db868..0cf20ce 100644 --- a/modules/home-manager/programs/neovim/default.nix +++ b/modules/home-manager/programs/neovim/default.nix @@ -143,11 +143,6 @@ in source = ./queries; }; - xdg.configFile."nvim/ftplugin" = { - recursive = true; - source = ./ftplugin; - }; - xdg.configFile."nvim/lua/plugins/astrolsp.lua".source = pkgs.runCommand "astrolsp.lua" { } '' cp ${./lsp.lua} $out diff --git a/modules/home-manager/programs/neovim/ftplugin/cs.lua b/modules/home-manager/programs/neovim/ftplugin/cs.lua deleted file mode 100644 index 3b69f26..0000000 --- a/modules/home-manager/programs/neovim/ftplugin/cs.lua +++ /dev/null @@ -1,137 +0,0 @@ ----@class CSFTPlugin.Project ----@field dll_path string ----@field name string ----@field target_framework string - ----@class CSFTPlugin ----@field dotnet_cmd string? ----@field projects CSFTPlugin.Project[] -local M = { - dotnet_cmd = vim.fn.exepath "dotnet", - projects = {}, -} - ----@param command string The shell command to execute ----@return string[] -function M.cmd(command) - -- execute command - local exec_return = vim.fn.execute("!" .. command) - - -- get the output by line - local output = vim.tbl_filter( - ---@param item string - ---@return boolean - function(item) - if item == "" then - return false - else - return true - end - end, - vim.split(exec_return, "[\n]") - ) - - -- remove echo line (":!") - table.remove(output, 1) - - return output -end - ----@return CSFTPlugin.Project[] -function M.find_projects() - local projects = {} - - local csproj_extension = ".csproj" - - local csproj_files = M.cmd("find . -name '*" .. csproj_extension .. "'") - - for _, file_path in ipairs(csproj_files) do - local sub_start, sub_end = string.find(file_path, "%w+%" .. csproj_extension) - - local project_name = string.sub(file_path, sub_start or 1, sub_end - #csproj_extension) - local project_location = string.sub(file_path, 1, sub_start - 1) - - local target_framework = M.cmd("rg -e 'TargetFramework>(.*)<' -r '$1' -o " .. file_path)[1] - - projects[#projects + 1] = { - dll_path = project_location .. "bin/Debug/" .. target_framework .. "/" .. project_name .. ".dll", - name = project_name, - target_framework = target_framework, - } - end - - return projects -end - ----@param command string The dotnet CLI command to run ----@return string[] -function M:run(command) - return M.cmd(self.dotnet_cmd .. " " .. command) -end - ----@return boolean -function M:check_version() - local cmd_output = self:run "--version" - - local sub_start = string.find(cmd_output[1], "%d+%.%d+%.%d+") - if not sub_start then - return false - end - - return true -end - ----@return thread -function M:choose_dll() - return coroutine.create(function(search_coroutine) - vim.ui.select( - self.projects, - { - prompt = "Select project to debug:", - ---@param item CSFTPlugin.Project - ---@return string - format_item = function(item) - return item.name - end, - }, - ---@param item CSFTPlugin.Project - function(item) - self:run "build" - - coroutine.resume(search_coroutine, item and item.dll_path or require("dap").ABORT) - end - ) - end) -end - -function M:start() - local has_dotnet = self:check_version() - - if not has_dotnet then - vim.notify_once("dotnet executable not present of malfunctioning", vim.log.levels.ERROR) - return - end - - self.projects = self.find_projects() - - local dap = require "dap" - - dap.configurations.cs = { - { - type = "netcoredbg", - name = "Launch project DLL", - request = "launch", - program = function() - return self:choose_dll() - end, - }, - } - - vim.notify_once("Loaded projects for nvim-dap", vim.log.levels.INFO) - - vim.g.loaded_csftplugin = true -end - -if not vim.g.loaded_csftplugin then - M:start() -end diff --git a/modules/home-manager/programs/neovim/lua/plugins/luasnip.lua b/modules/home-manager/programs/neovim/lua/plugins/luasnip.lua deleted file mode 100644 index 7827042..0000000 --- a/modules/home-manager/programs/neovim/lua/plugins/luasnip.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - "L3MON4D3/LuaSnip", - config = function(plugin, opts) - -- include the default astronvim config that calls the setup call - require "astronvim.plugins.configs.luasnip" (plugin, opts) - - -- load snippets paths - require("luasnip.loaders.from_lua").lazy_load { - paths = { vim.fn.stdpath "config" .. "/snippets" }, - } - - -- extend 'razor' files with html snippets - require("luasnip").filetype_extend("razor", { "html" }) - end, -} diff --git a/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm b/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm index 9c2da39..2ec6b8b 100644 --- a/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm +++ b/modules/home-manager/programs/neovim/queries/c_sharp/folds.scm @@ -5,12 +5,10 @@ (preproc_region) @region_begin . [ - (comment) (declaration) - (statement) (type_declaration) ]* . - (preproc_endregion) @region_end (#offset! @region_end 0 0 -1 0) + (preproc_endregion) @region_end (#make-range! "fold" @region_begin @region_end) )