Fix csharp and dotnet projectionist config

pull/1/head
Ensar Sarajčić 2021-05-21 22:08:28 +02:00
parent 14d0bd0069
commit 37c954c329
5 changed files with 78 additions and 17 deletions

View File

@ -0,0 +1,2 @@
setlocal ts=4 sts=4 sw=4 expandtab autoindent
let b:undo_ftplugin = '|setlocal ts< sts< sw< expandtab< autoindent<'

View File

@ -10,6 +10,7 @@ return require('packer').startup {
use 'tpope/vim-vinegar' -- Netrw improvements
use 'tpope/vim-obsession' -- Session.vim management
use 'tpope/vim-dadbod' -- Database access
use 'kristijanhusak/vim-dadbod-ui' -- UI For Dadbod
use 'tpope/vim-speeddating' -- <C-A> and <C-X> for dates
use 'tpope/vim-dispatch' -- Dispatch command
use 'tpope/vim-projectionist' -- Project config file!

View File

@ -25,7 +25,7 @@ local on_attach = function(client, bufnr)
end
-- Lsp default language servers
local servers = { "bashls", "clangd", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls", "clojure_lsp" }
local servers = { "bashls", "clangd", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls", "clojure_lsp", "gopls" }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup { on_attach = on_attach }
end

View File

@ -146,27 +146,76 @@ local python_config = {
}
}
local dotnet_config = {
["*"] = {
start = "dotnet run",
shell = "dotnet fsi"
local dotnet_solution_config = {
["src/**/Controllers/*.cs"] = {
type = "controller",
alternate = {
"tests/{dirname}.Tests/Controllers/{basename}Tests.cs",
"tests/{dirname}.IntegrationTests/Controllers/{basename}Tests.cs"
}
},
["src/Controllers/*.cs"] = {
type = "controller"
["src/**/Models/*.cs"] = {
type = "model",
alternate = "tests/{dirname}.Tests/Models/{basename}Tests.cs"
},
["src/Models/*.cs"] = {
type = "model"
["src/**/Views/*.cshtml"] = {
type = "view",
alternate = "tests/{dirname}.Tests/Views/{basename}Tests.cs"
},
["src/Views/*.cshtml"] = {
type = "view"
["src/**/Services/*.cs"] = {
type = "service",
alternate = "tests/{dirname}.Tests/Services/{basename}Tests.cs"
},
["src/*.cs"] = {
["src/**/appsettings*json"] = {
type = "appsettings"
},
["src/**/*.cs"] = {
type = "source",
alternate = "tests/{}Tests.cs"
alternate = "tests/{dirname}.Tests/{basename}Tests.cs",
template = {
"using System;",
"",
"namespace {dirname|dot}",
"{",
" public class {basename}",
" {",
" }",
"}"
}
},
["tests/*Tests.cs"] = {
["tests/**.IntegrationTests/Controllers/*Tests.cs"] = {
type = "test",
alternate = "src/{}.cs"
alternate = "src/{dirname}/Controllers/{basename}.cs"
},
["tests/**.Tests/Controllers/*Tests.cs"] = {
type = "test",
alternate = "src/{dirname}/Controllers/{basename}.cs"
},
["tests/**.Tests/Views/*Tests.cs"] = {
type = "test",
alternate = "src/{dirname}/Views/{basename}.cs"
},
["tests/**.Tests/Models/*Tests.cs"] = {
type = "test",
alternate = "src/{dirname}/Models/{basename}.cs"
},
["tests/**.Tests/Services/*Tests.cs"] = {
type = "test",
alternate = "src/{dirname}/Services/{basename}.cs"
},
["tests/**/*Tests.cs"] = {
type = "test",
alternate = "src/{dirname}/{basename}.cs",
template = {
"using System;",
"",
"namespace {dirname|dot}",
"{",
" public class {basename}Tests",
" {",
" }",
"}"
}
}
}
@ -222,10 +271,18 @@ local lua_vim_plugin_config = {
}
}
local csharp_project_config = {
["*"] = {
start = "dotnet run",
console = "dotnet fsi"
}
}
vim.g.projectionist_heuristics = {
["pubspec.yaml"] = flutter_config,
["requirements.txt|pyproject.toml"] = python_config,
["*.csproj"] = dotnet_config,
["*.sln"] = dotnet_solution_config,
["*.csproj"] = csharp_project_config,
["plugin/|autoload/"] = vim_plugin_config,
["lua/"] = lua_vim_plugin_config
}

View File

@ -11,7 +11,7 @@ let g:ale_linters = {}
let g:ale_linters.python = ['flake8']
let g:ale_linters.kotlin = ['ktlint']
let g:ale_linters.clojure = []
let g:ale_linters.cs = ['OmniSharp']
let g:ale_linters.cs = ['OmniSharp']
" ALE Fixers configuration
let g:ale_fixers = {}
@ -19,6 +19,7 @@ let g:ale_fixers['*'] = ['remove_trailing_lines', 'trim_whitespace']
let g:ale_fixers.python = ['autopep8', 'isort']
let g:ale_fixers.dart = ['dartfmt']
let g:ale_fixers.lua = ['luafmt']
let g:ale_fixers.go = ['gofmt']
" Warnings navigation
nmap <silent> [W <Plug>(ale_first)