feat(nvim): omnisharp -> roslyn-ls
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
fa5fcfe8fd
commit
d563c80bd0
8 changed files with 56 additions and 40 deletions
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
using HomeAssistantGenerated;
|
using HomeAssistantGenerated;
|
||||||
|
|
||||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
|
@ -50,6 +50,9 @@ in {
|
||||||
silent = true,
|
silent = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
-- https://github.com/seblj/roslyn.nvim/issues/121#issuecomment-2544076963
|
||||||
|
vim.opt.cmdheight = 2;
|
||||||
|
|
||||||
-- Get rid of deprecated messages
|
-- Get rid of deprecated messages
|
||||||
vim.tbl_add_reverse_lookup = function(tbl)
|
vim.tbl_add_reverse_lookup = function(tbl)
|
||||||
for k, v in pairs(tbl) do
|
for k, v in pairs(tbl) do
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
{
|
self: {
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) attrValues mkIf;
|
inherit (lib) attrValues mkIf;
|
||||||
|
inherit (self.lib.${pkgs.system}) buildPlugin;
|
||||||
|
inherit (self.inputs) vimplugin-roslyn-nvim-src;
|
||||||
|
|
||||||
cfg = config.programs.neovim;
|
cfg = config.programs.neovim;
|
||||||
in
|
in {
|
||||||
mkIf cfg.enableIde {
|
config = mkIf cfg.enableIde {
|
||||||
programs = {
|
programs = {
|
||||||
neovim = {
|
neovim = {
|
||||||
extraPackages = attrValues {
|
extraPackages = attrValues {
|
||||||
inherit
|
inherit
|
||||||
(pkgs)
|
(pkgs)
|
||||||
omnisharp-roslyn
|
roslyn-ls
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,45 +28,51 @@ in
|
||||||
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
|
||||||
});
|
});
|
||||||
|
|
||||||
local omnisharp_extended = require('omnisharp_extended');
|
vim.api.nvim_create_autocmd('User', {
|
||||||
|
pattern = 'RoslynInitialized',
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.inlay_hint.enable();
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
|
||||||
require('lspconfig').omnisharp.setup({
|
-- FIXME: make editorconfig and format work
|
||||||
cmd = { 'dotnet', '${pkgs.omnisharp-roslyn}/lib/omnisharp-roslyn/OmniSharp.dll' },
|
require('roslyn').setup({
|
||||||
|
config = {
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
|
||||||
handlers = {
|
on_attach = function()
|
||||||
['textDocument/definition'] = omnisharp_extended.definition_handler,
|
vim.lsp.inlay_hint.enable();
|
||||||
['textDocument/typeDefinition'] = omnisharp_extended.type_definition_handler,
|
end,
|
||||||
['textDocument/references'] = omnisharp_extended.references_handler,
|
|
||||||
['textDocument/implementation'] = omnisharp_extended.implementation_handler,
|
settings = {
|
||||||
|
["csharp|inlay_hints"] = {
|
||||||
|
csharp_enable_inlay_hints_for_implicit_object_creation = true,
|
||||||
|
csharp_enable_inlay_hints_for_implicit_variable_types = true,
|
||||||
|
csharp_enable_inlay_hints_for_lambda_parameter_types = true,
|
||||||
|
csharp_enable_inlay_hints_for_types = true,
|
||||||
|
dotnet_enable_inlay_hints_for_indexer_parameters = true,
|
||||||
|
dotnet_enable_inlay_hints_for_literal_parameters = true,
|
||||||
|
dotnet_enable_inlay_hints_for_object_creation_parameters = true,
|
||||||
|
dotnet_enable_inlay_hints_for_other_parameters = true,
|
||||||
|
dotnet_enable_inlay_hints_for_parameters = true,
|
||||||
|
dotnet_suppress_inlay_hints_for_parameters_that_differ_only_by_suffix = true,
|
||||||
|
dotnet_suppress_inlay_hints_for_parameters_that_match_argument_name = true,
|
||||||
|
dotnet_suppress_inlay_hints_for_parameters_that_match_method_intent = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
settings = {
|
exe = 'Microsoft.CodeAnalysis.LanguageServer',
|
||||||
FormattingOptions = {
|
|
||||||
EnableEditorConfigSupport = true,
|
|
||||||
OrganizeImports = true,
|
|
||||||
},
|
|
||||||
MsBuild = {
|
|
||||||
LoadProjectsOnDemand = false,
|
|
||||||
},
|
|
||||||
RoslynExtensionsOptions = {
|
|
||||||
EnableAnalyzersSupport = true,
|
|
||||||
EnableDecompilationSupport = true,
|
|
||||||
EnableImportCompletion = true,
|
|
||||||
AnalyzeOpenDocumentsOnly = false,
|
|
||||||
},
|
|
||||||
Sdk = {
|
|
||||||
IncludePrereleases = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
'';
|
'';
|
||||||
|
|
||||||
plugins = attrValues {
|
plugins = [
|
||||||
inherit
|
(buildPlugin "roslyn-nvim" vimplugin-roslyn-nvim-src)
|
||||||
(pkgs.vimPlugins)
|
];
|
||||||
omnisharp-extended-lsp-nvim
|
|
||||||
;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
# For accurate stack trace
|
||||||
|
_file = ./csharp.nix;
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ in {
|
||||||
imports = [
|
imports = [
|
||||||
./bash.nix
|
./bash.nix
|
||||||
./clang.nix
|
./clang.nix
|
||||||
./csharp.nix
|
|
||||||
./hyprlang.nix
|
./hyprlang.nix
|
||||||
./java.nix
|
./java.nix
|
||||||
./json.nix
|
./json.nix
|
||||||
|
@ -19,6 +18,7 @@ in {
|
||||||
./python.nix
|
./python.nix
|
||||||
./rust.nix
|
./rust.nix
|
||||||
|
|
||||||
|
(import ./csharp.nix self)
|
||||||
(import ./markdown.nix self)
|
(import ./markdown.nix self)
|
||||||
(import ./nix.nix self)
|
(import ./nix.nix self)
|
||||||
(import ./web.nix self)
|
(import ./web.nix self)
|
||||||
|
|
|
@ -276,6 +276,11 @@ let
|
||||||
owner = "dmmulroy";
|
owner = "dmmulroy";
|
||||||
repo = "ts-error-translator.nvim";
|
repo = "ts-error-translator.nvim";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "vimplugin-roslyn-nvim-src";
|
||||||
|
owner = "seblj";
|
||||||
|
repo = "roslyn.nvim";
|
||||||
|
}
|
||||||
|
|
||||||
# Overlays & packages
|
# Overlays & packages
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ in {
|
||||||
;
|
;
|
||||||
});
|
});
|
||||||
|
|
||||||
# FIXME: Omnisharp uses dotnet6
|
# FIXME: Roslyn-ls uses dotnet6 https://github.com/NixOS/nixpkgs/blob/d3c42f187194c26d9f0309a8ecc469d6c878ce33/pkgs/by-name/ro/roslyn-ls/package.nix#L21
|
||||||
nixpkgs.config.permittedInsecurePackages = [
|
nixpkgs.config.permittedInsecurePackages = [
|
||||||
"dotnet-core-combined"
|
"dotnet-core-combined"
|
||||||
"dotnet-sdk-6.0.428"
|
"dotnet-sdk-6.0.428"
|
||||||
|
|
Loading…
Reference in a new issue