Roslyn is "working"

This commit is contained in:
Jeremy Wall 2024-01-09 08:30:42 -05:00
parent 5a1f4042e3
commit fcb1d2420b
4 changed files with 123 additions and 65 deletions

View File

@ -512,9 +512,28 @@
"nil-flake": "nil-flake",
"nixpkgs": "nixpkgs_5",
"nurl-flake": "nurl-flake",
"roslyn-lsp": "roslyn-lsp",
"runwhen-flake": "runwhen-flake",
"rust-overlay-flake": "rust-overlay-flake",
"sile-flake": "sile-flake"
"sile-flake": "sile-flake",
"treesitter-context": "treesitter-context"
}
},
"roslyn-lsp": {
"flake": false,
"locked": {
"lastModified": 1704752101,
"narHash": "sha256-eWKAdrKfuBqSoOW70BSqcANrGQ+NwbmCL8C1jLXdNt8=",
"owner": "zaphar",
"repo": "roslyn.nvim",
"rev": "f1301be34ff786036867137228f3d9f65a3434af",
"type": "github"
},
"original": {
"owner": "zaphar",
"ref": "non_nightly",
"repo": "roslyn.nvim",
"type": "github"
}
},
"runwhen-flake": {
@ -689,6 +708,23 @@
"repo": "default",
"type": "github"
}
},
"treesitter-context": {
"flake": false,
"locked": {
"lastModified": 1693236978,
"narHash": "sha256-B6BXeFEWxTFf46JrlatsxEQcC6+/hPIDBb5cIcJpLZg=",
"owner": "nvim-treesitter",
"repo": "nvim-treesitter-context",
"rev": "e6b743ccd4e780bc9cd85b707de67df72eea1a23",
"type": "github"
},
"original": {
"owner": "nvim-treesitter",
"repo": "nvim-treesitter-context",
"rev": "e6b743ccd4e780bc9cd85b707de67df72eea1a23",
"type": "github"
}
}
},
"root": "root",

View File

@ -23,6 +23,11 @@
url = "github:nvim-treesitter/nvim-treesitter-context/e6b743ccd4e780bc9cd85b707de67df72eea1a23";
flake = false;
};
# We need to pin to this version of treesitter because it breaks after this revision
roslyn-lsp = {
url = "github:zaphar/roslyn.nvim/non_nightly";
flake = false;
};
};
outputs = {
sile-flake,
@ -35,6 +40,7 @@
nurl-flake,
harpoon-src,
treesitter-context,
roslyn-lsp,
nixpkgs,
... # We don't use the self or nixpkgs args here so we just glob it.
}: {
@ -44,10 +50,6 @@
in
{ config, ...}: let
pkgs = nixPkgs;
nvim-treesitter-csharp = pkgs.callPackage ./nvim-treesitter-csharp.nix {
inherit (pkgs.tree-sitter) buildGrammar;
inherit (pkgs) fetchFromGitHub;
};
possession-nvim = pkgs.callPackage ./possession-nvim.nix {
inherit (pkgs.vimUtils) buildVimPlugin;
inherit (pkgs) fetchFromGitHub;
@ -60,23 +62,15 @@
name = "nvim-treesitter-context";
src = treesitter-context;
};
roslyn-nvim = pkgs.vimUtils.buildVimPlugin {
name = "roslyn-nvim";
src = roslyn-lsp;
};
# TODO(jwall): When this actually builds we should use it.
#nvim-treesitter-powershell = pkgs.callPackage ./nvim-powershell.nix {
# inherit (pkgs.tree-sitter) buildGrammar;
# inherit (pkgs) fetchFromGitHub;
#};
expected-parsers = (pkgs.lib.attrVals [
"tree-sitter-lua"
"tree-sitter-toml"
"tree-sitter-yaml"
"tree-sitter-json"
"tree-sitter-html"
"tree-sitter-css"
"tree-sitter-nix"
"tree-sitter-ocaml"
"tree-sitter-tlaplus"
"tree-sitter-julia"
] pkgs.tree-sitter.builtGrammars) ++ [nvim-treesitter-csharp];
in {
imports = [
./program-neovim.nix
@ -117,6 +111,7 @@ EOF";
vimagit
hoon-vim
nvim-treesitter
roslyn-nvim
nvim-treesitter-context
nvim-treesitter-textobjects
nvim-treesitter-parsers.ini

View File

@ -111,8 +111,6 @@ cmp.setup({
--vim.lsp.set_log_level('trace')
--vim.lsp.log.set_format_func(vim.inspect)
local roslyn_lsp_dll = vim.fs.normalize("~/bin/Microsoft.CodeAnalysis.LanguageServer.dll")
local caps = vim.tbl_deep_extend(
'force',
vim.lsp.protocol.make_client_capabilities(),
@ -122,6 +120,9 @@ local caps = vim.tbl_deep_extend(
{ workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } },
{ window = { progress = false } }
);
vim.lsp.set_log_level(vim.log.levels.TRACE)
local lspconfig = require("lspconfig")
-- Terraform lsp setup
@ -137,37 +138,45 @@ lspconfig.nil_ls.setup {
capabilities = caps,
}
require('roslyn').setup({
on_attach = function (client, _)
--vim.notify(vim.inspect(client))
end,
capabilities = caps,
log_level = "Trace",
});
local vim_pid = vim.fn.getpid()
-- "FormatterOptions:EnableEditorConfigSupport=true"
local omnisharp_cmd = { 'omnisharp', '--languageserver', '-v', '--hostPID', tostring(vim_pid), }
local function toSnakeCase(str)
return string.gsub(str, "%s*[- ]%s*", "_")
end
lspconfig.omnisharp.setup {
cmd = omnisharp_cmd,
enable_roslyn_analyzers = true,
enable_editorconfig_support = true,
enable_import_completion = true,
-- Omnisharp has issues with the semanticTokens feature we need to massage it a bit.
on_attach = function(client, bufnr)
-- https://github.com/OmniSharp/omnisharp-roslyn/issues/2483#issuecomment-1492605642
local tokenModifiers = client.server_capabilities.semanticTokensProvider.legend.tokenModifiers
for i, v in ipairs(tokenModifiers) do
tokenModifiers[i] = toSnakeCase(v)
end
local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes
for i, v in ipairs(tokenTypes) do
tokenTypes[i] = toSnakeCase(v)
end
end,
handlers = {
["textDocument/definition"] = require('omnisharp_extended').handler,
},
capabilities = caps,
}
--local omnisharp_cmd = { 'omnisharp', '--languageserver', '-v', '--hostPID', tostring(vim_pid), }
--
--local function toSnakeCase(str)
-- return string.gsub(str, "%s*[- ]%s*", "_")
--end
--
--lspconfig.omnisharp.setup {
-- cmd = omnisharp_cmd,
-- enable_roslyn_analyzers = true,
-- enable_editorconfig_support = true,
-- enable_import_completion = true,
-- -- Omnisharp has issues with the semanticTokens feature we need to massage it a bit.
-- on_attach = function(client, bufnr)
-- -- https://github.com/OmniSharp/omnisharp-roslyn/issues/2483#issuecomment-1492605642
-- local tokenModifiers = client.server_capabilities.semanticTokensProvider.legend.tokenModifiers
-- for i, v in ipairs(tokenModifiers) do
-- tokenModifiers[i] = toSnakeCase(v)
-- end
-- local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes
-- for i, v in ipairs(tokenTypes) do
-- tokenTypes[i] = toSnakeCase(v)
-- end
-- end,
-- handlers = {
-- ["textDocument/definition"] = require('omnisharp_extended').handler,
-- },
-- capabilities = caps,
--}
--ocaml
lspconfig.ocamllsp.setup {

54
nix/darwin/flake.lock generated
View File

@ -7,11 +7,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1690228878,
"narHash": "sha256-9Xe7JV0krp4RJC9W9W9WutZVlw6BlHTFMiUP/k48LQY=",
"lastModified": 1694793763,
"narHash": "sha256-y6gTE1C9mIoSkymRYyzCmv62PFgy+hbZ5j8fuiQK5KI=",
"owner": "ryantm",
"repo": "agenix",
"rev": "d8c973fd228949736dedf61b7f8cc1ece3236792",
"rev": "572baca9b0c592f71982fca0790db4ce311e3c75",
"type": "github"
},
"original": {
@ -29,6 +29,7 @@
"nil-flake": "nil-flake",
"nixpkgs": "nixpkgs_5",
"nurl-flake": "nurl-flake",
"roslyn-lsp": "roslyn-lsp",
"runwhen-flake": "runwhen-flake",
"rust-overlay-flake": "rust-overlay-flake",
"sile-flake": "sile-flake",
@ -36,12 +37,12 @@
},
"locked": {
"lastModified": 1,
"narHash": "sha256-he52upxte7/ueHwKdbZxrQHwkcsZtRzjM8JTPlhA/O0=",
"path": "/nix/store/1syscqfij22hmdnwsvb3gjkvqddz4mq0-source/nix/base-system",
"narHash": "sha256-LPZptn4TgP1Rk6u1FQauqeRdswDP5VxmhlE8AfFVRFE=",
"path": "/nix/store/89vbp2wn5hvs421h8c220jazqfcrbwf0-source/nix/base-system",
"type": "path"
},
"original": {
"path": "/nix/store/1syscqfij22hmdnwsvb3gjkvqddz4mq0-source/nix/base-system",
"path": "/nix/store/89vbp2wn5hvs421h8c220jazqfcrbwf0-source/nix/base-system",
"type": "path"
}
},
@ -324,11 +325,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1693791390,
"narHash": "sha256-FnT7/iDcGLWSmzwDfD7RQwr7z5+U2j7YOqhR3UM3zrg=",
"lastModified": 1694797768,
"narHash": "sha256-CA9AQ+lvgbCOfH++A0rHKguTBBn0EEcVRLMAmkDecQo=",
"owner": "martinvonz",
"repo": "jj",
"rev": "e3c85d6ecc20ee4240cdf3ed80107ce7dc268abe",
"rev": "e288a152d052a531e0ccb25ae27ce07412d65447",
"type": "github"
},
"original": {
@ -549,11 +550,11 @@
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1695751852,
"narHash": "sha256-4jG+8LPHteAAEfUOtlwK0piK79fQsAMp/SA6Lpob+JQ=",
"lastModified": 1701273941,
"narHash": "sha256-MwDKOU2JZRHObIJLFbge+XS3ov54dAlDGtzWPtq7/PE=",
"owner": "nix-community",
"repo": "nurl",
"rev": "715246bc9748cf196dafc7795812dec825e30b4b",
"rev": "caf9e815a036eec02eac877798ebc9b379adc810",
"type": "github"
},
"original": {
@ -568,6 +569,23 @@
"darwin": "darwin_2"
}
},
"roslyn-lsp": {
"flake": false,
"locked": {
"lastModified": 1704752101,
"narHash": "sha256-eWKAdrKfuBqSoOW70BSqcANrGQ+NwbmCL8C1jLXdNt8=",
"owner": "zaphar",
"repo": "roslyn.nvim",
"rev": "f1301be34ff786036867137228f3d9f65a3434af",
"type": "github"
},
"original": {
"owner": "zaphar",
"ref": "non_nightly",
"repo": "roslyn.nvim",
"type": "github"
}
},
"runwhen-flake": {
"inputs": {
"flake-compat": "flake-compat_2",
@ -624,11 +642,11 @@
]
},
"locked": {
"lastModified": 1693793487,
"narHash": "sha256-MS6CDyAC0sJMTE/pRYlfrhBnhlAPvEo43ipwf5ZNzHg=",
"lastModified": 1694743934,
"narHash": "sha256-4pn0x+OiOFWefBpgyufFVaAeG+LwfVUI/HMCma8xdHU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "f179280eed5eb93759c94bf3231fbbda28f894b7",
"rev": "6a26dd6da9b4f28d9b4c397bd22b5df4bec8f78a",
"type": "github"
},
"original": {
@ -673,11 +691,11 @@
"nixpkgs": "nixpkgs_8"
},
"locked": {
"lastModified": 1692759315,
"narHash": "sha256-nRA6Oad/CwUdMXlHpv1wW1IY5Pp100BJvIscd1AlYbI=",
"lastModified": 1694595810,
"narHash": "sha256-tqeteJwXs77NOoSw3jwQu4ImP8wH+omEwNq6MZycrDM=",
"owner": "sile-typesetter",
"repo": "sile",
"rev": "fa84d15c902df4859caff8af8325097022b62f3e",
"rev": "770d2b9f68297bb5e9ce75182bf6e57ae1cce3b9",
"type": "github"
},
"original": {