more changes, c# working now?

This commit is contained in:
Solomon Laing 2023-10-23 20:22:19 +10:30
parent 496bdcc57f
commit 82fd91c691
6 changed files with 45 additions and 46 deletions

View File

@ -6,7 +6,7 @@ case $- in
esac esac
export GOPATH="$HOME/go" export GOPATH="$HOME/go"
export PATH="$HOME/.local/bin:$PATH:$GOPATH/bin:$HOME/scripts:$HOME/.dotnet/" export PATH="$HOME/.local/bin:$PATH:$GOPATH/bin:$HOME/scripts:$HOME/.dotnet/:$HOME/.dotnet/tools/"
# don't put duplicate lines or lines starting with space in the history. # don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options # See bash(1) for more options
@ -98,7 +98,11 @@ PROMPT_COMMAND=set_prompt
# direnv for go # direnv for go
# eval "$(direnv hook bash)" # eval "$(direnv hook bash)"
# cargo
[[ -s "$HOME/.local/share/cargo/env" ]] && source "/home/solomon/.local/share/cargo/env"
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman" export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
. "/home/solomon/.local/share/cargo/env"

View File

@ -21,7 +21,7 @@ cmd open ${{
application/vnd.oasis.opendocument.text) lowriter $fs ;; application/vnd.oasis.opendocument.text) lowriter $fs ;;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/*|application/json|inode/x-empty) $EDITOR $fx;; text/*|application/json|application/javascript|inode/x-empty) $EDITOR $fx;;
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
image/svg+xml) display -- $f ;; image/svg+xml) display -- $f ;;
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |

View File

@ -4,9 +4,7 @@ return {
event = "InsertEnter", event = "InsertEnter",
dependencies = { dependencies = {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-emoji", "hrsh7th/cmp-emoji",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
}, },
@ -33,9 +31,7 @@ return {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "buffer" },
{ name = "path" }, { name = "path" },
{ name = "cmdline" },
{ name = "emoji" }, { name = "emoji" },
}), }),
formatting = { formatting = {

View File

@ -34,6 +34,7 @@ return {
}, },
}, },
ltex = { ltex = {
mason = true,
settings = { settings = {
ltex = { ltex = {
language = "en-AU", language = "en-AU",
@ -41,25 +42,43 @@ return {
}, },
}, },
rust_analyzer = { rust_analyzer = {
capabilities = capabilities, mason = false,
on_attach = on_attach,
cmd = { cmd = {
"rustup", "rustup",
"run", "run",
"stable", "stable",
"rust-analyzer", "rust-analyzer",
}, },
}, },
omnisharp = {},
}, },
setup = { setup = {
-- additional setup can be added here. -- additional setup can be added here.
omnisharp = function(_, _)
require("lazyvim.utils").on_attach(function(client, _)
if client.name == "omnisharp" then
---@type string[]
local tokenModifiers =
client.server_capabilities.semanticTokensProvider.legend.tokenModifiers
for i, v in ipairs(tokenModifiers) do
tokenModifiers[i] = v:gsub(" ", "_")
end
---@type string[]
local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes
for i, v in ipairs(tokenTypes) do
tokenTypes[i] = v:gsub(" ", "_")
end
end
end)
return false
end,
}, },
}, },
config = function(plugin, opts) config = function(_, opts)
local Util = require("lazyvim.utils") local Util = require("lazyvim.utils")
-- setup autoformat -- setup autoformat
require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat
-- setup formatting and keymaps -- setup formatting and keymaps
Util.on_attach(function(client, buffer) Util.on_attach(function(client, buffer)
require("lazyvim.plugins.lsp.format").on_attach(client, buffer) require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
@ -139,37 +158,7 @@ return {
end, end,
}, },
-- formatters -- formatting
-- {
-- "jose-elias-alvarez/null-ls.nvim",
-- event = "BufReadPre",
-- dependencies = { "mason.nvim" },
-- opts = function()
-- local nls = require("null-ls")
-- return {
-- root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
-- debug = false,
-- sources = {
-- nls.builtins.formatting.stylua,
-- nls.builtins.formatting.prettier.with({
-- filetypes = {
-- "javascript",
-- "typescript",
-- "css",
-- "scss",
-- "html",
-- "json",
-- "yaml",
-- },
-- }),
-- nls.builtins.formatting.black.with({ extra_args = { "--fast" } }),
-- nls.builtins.formatting.bibclean,
-- nls.builtins.formatting.beautysh,
-- nls.builtins.diagnostics.shellcheck,
-- },
-- }
-- end,
-- },
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
opts = { opts = {
@ -178,7 +167,14 @@ return {
-- Conform will run multiple formatters sequentially -- Conform will run multiple formatters sequentially
python = { "isort", "black" }, python = { "isort", "black" },
-- Use a sub-list to run only the first available formatter -- Use a sub-list to run only the first available formatter
javascript = { { "prettierd", "prettier" } }, typescript = { { "prettierd", "prettier" } },
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
}, },
}, },
}, },
@ -189,13 +185,14 @@ return {
cmd = "Mason", cmd = "Mason",
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } }, keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
opts = { opts = {
automatic_istallation = false,
ensure_installed = { ensure_installed = {
"stylua", "stylua",
"shellcheck", "shellcheck",
"shfmt", "shfmt",
}, },
}, },
config = function(plugin, opts) config = function(_, opts)
require("mason").setup() require("mason").setup()
local mr = require("mason-registry") local mr = require("mason-registry")
for _, tool in ipairs(opts.ensure_installed) do for _, tool in ipairs(opts.ensure_installed) do
@ -206,6 +203,8 @@ return {
end end
end, end,
}, },
-- language specific tooling
{ {
"simrat39/rust-tools.nvim", "simrat39/rust-tools.nvim",
opts = { opts = {
@ -220,5 +219,4 @@ return {
}, },
}, },
}, },
require("lazyvim.plugins.lsp.lang.c_sharp"),
} }

View File

@ -11,6 +11,7 @@ return {
{ "<leader>ff", util.telescope("find_files"), desc = "Find Files (root dir)" }, { "<leader>ff", util.telescope("find_files"), desc = "Find Files (root dir)" },
{ "<leader>fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" }, { "<leader>fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" }, { "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
{ "<leader>fp", "<cmd>Telescope projects<cr>", desc = "Find Projects" },
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" }, { "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" }, { "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
{ "<leader>gb", "<cmd>Telescope git_branches<CR>", desc = "branches" }, { "<leader>gb", "<cmd>Telescope git_branches<CR>", desc = "branches" },

View File

@ -26,7 +26,7 @@ function M.get_root()
---@type string[] ---@type string[]
local roots = {} local roots = {}
if path then if path then
for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
local workspace = client.config.workspace_folders local workspace = client.config.workspace_folders
local paths = workspace local paths = workspace
and vim.tbl_map(function(ws) and vim.tbl_map(function(ws)