Open Crashdummyy opened 4 months ago
Interesting... Ideally, I would like to not have any lua code dealing with downloading the language server. Personally, I think I would prefer it we could get it into the mason registry.
I tried to look a bit into that myself actually a couple of days ago, but I couldn't find an easy way without doing something like creating a github repo that downloads new releases.
So what I would prefer, is that one of us tries to create a PR to mason to see if they would accept a PR. I think in the first place, we should not add it to mason-lspconfig, because that would then be included in trying to automatically setup the language server with nvim-lspconfig if a user is using the setup_handlers
. I would then of course fix the path for mason download in this repo for it to just work
What do you think?
Interesting... Ideally, I would like to not have any lua code dealing with downloading the language server. Personally, I think I would prefer it we could get it into the mason registry.
I tried to look a bit into that myself actually a couple of days ago, but I couldn't find an easy way without doing something like creating a github repo that downloads new releases.
So what I would prefer, is that one of us tries to create a PR to mason to see if they would accept a PR. I think in the first place, we should not add it to mason-lspconfig, because that would then be included in trying to automatically setup the language server with nvim-lspconfig if a user is using the
setup_handlers
. I would then of course fix the path for mason download in this repo for it to just workWhat do you think?
Mason would be great. I've tried to get any download at all but the azure package registry either sucks really bad or is not configured correctly.
The only reliable way to download the lsp appears to be using dotnet PackageDownload.
But that still leaves the issue at on how to obtain the latest version. I at least think its easier to crawl the releases and provide them through github or something like that where it's easier to get the latest release
Yes, when I tried to look into getting it to mason, I saw that there was several packages that seemed to be annoying to download, so someone created a github repo which crawls it to download (just like you have done). Then they would use that github repo to provide to mason, and from what I could understand, it would then just work with the PURL
spec that mason is using.
So I think we can just point mason to your repo for downloading
Yes, when I tried to look into getting it to mason, I saw that there was several packages that seemed to be annoying to download, so someone created a github repo which crawls it to download (just like you have done). Then they would use that github repo to provide to mason, and from what I could understand, it would then just work with the
PURL
spec that mason is using.So I think we can just point mason to your repo for downloading
That'd be really great. I am really inexperienced in using lua ( basically just starting with nvim ) but I at least plan on keeping this repository maintained at least till Microsoft provides some official way of downloading this.
But I read somewhere in a discussion or issue that this is not planned at all ( thus I created this repository )
I can look into sending a PR to mason that downloads from your repo😄 I'll use this issue as a tracker, and can provide updates here. Thank you for creating that repo!
I can look into sending a PR to mason that downloads from your repo😄 I'll use this issue as a tracker, and can provide updates here. Thank you for creating that repo!
Thanks. That'd be amazing.
How'd you go about providing weird hacks in the default configuration?
Like semantics wont work as of now so you have to monkey patch the request a bit.
function M.monkeyPatchSemanticTokens(client)
local utils = require("base.utils")
-- make sure this happens once per client, not per buffer
if not client.is_hacked then
client.is_hacked = true
-- let the runtime know the server can do semanticTokens/full now
if client.server_capabilities.semanticTokensProvider then
client.server_capabilities = vim.tbl_deep_extend("force", client.server_capabilities, {
semanticTokensProvider = {
full = true,
},
})
end
utils.notify("patching the semantic tokens for roslyn")
-- monkey patch the request proxy
local request_inner = client.request
client.request = function(method, params, handler)
if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then
return request_inner(method, params, handler)
end
local function find_buf_by_uri(search_uri)
local bufs = vim.api.nvim_list_bufs()
for _, buf in ipairs(bufs) do
local name = vim.api.nvim_buf_get_name(buf)
local uri = "file://" .. name
if uri == search_uri then
return buf
end
end
end
local doc_uri = params.textDocument.uri
local target_bufnr = find_buf_by_uri(doc_uri)
local line_count = vim.api.nvim_buf_line_count(target_bufnr)
local last_line = vim.api.nvim_buf_get_lines(target_bufnr, line_count - 1, line_count, true)[1]
return request_inner("textDocument/semanticTokens/range", {
textDocument = params.textDocument,
range = {
["start"] = {
line = 0,
character = 0,
},
["end"] = {
line = line_count - 1,
character = string.len(last_line) - 1,
},
},
}, handler)
end
end
end
How'd you go about providing weird hacks in the default configuration?
What do you mean? If I am open to including this hack or?
I am not so familiar with semantic tokens and the specs for it. Could you explain a bit about why it is needed to patch it? I am open to include something like this if I can understand it a bit more and know why we do it😄
BTW: Already started looking into adding it to mason, and it is going great as of now! Could you do me a favour though? Could you also crawl for osx-x64 and win-arm64? It seems to be normal to also provide those.
Other than that, I think I have something working locally now
How'd you go about providing weird hacks in the default configuration?
What do you mean? If I am open to including this hack or?
I am not so familiar with semantic tokens and the specs for it. Could you explain a bit about why it is needed to patch it? I am open to include something like this if I can understand it a bit more and know why we do it😄
BTW: Already started looking into adding it to mason, and it is going great as of now! Could you do me a favour though? Could you also crawl for osx-x64 and win-arm64? It seems to be normal to also provide those.
Other than that, I think I have something working locally now
Oh no problem I'll add those in a sec.
The highlight doesn't work as Roslyn doesnt implement textDocuments/semantic tokens/full
.
This just patches range to be exposed as full.
Ahaa, I understand! I can look into adding that hack as a built in support :)
Ahaa, I understand! I can look into adding that hack as a built in support :)
I added the remaining versions
Thank you! I opened this: https://github.com/mason-org/mason-registry/pull/6330 so lets hope it gets accepted and is merged soon😄
I started looking into adding support for semantic tokens without you needing to have the snippet you sent in your config. It seems to work okay, but I need to think a little bit more about it and how I should do it, because it seems to be a bit buggy sometimes🤔
At first it seemed to be like that until I started to edit the text or do :e
, but now all of a sudden it seems to correct itself after a second or so.
I need to play with it a little bit to see how it behaves before I decide if I have to add a config for this or not, or if it should be enabled by default or not
I started looking into adding support for semantic tokens without you needing to have the snippet you sent in your config. It seems to work okay, but I need to think a little bit more about it and how I should do it, because it seems to be a bit buggy sometimes🤔
At first it seemed to be like that until I started to edit the text or do
:e
, but now all of a sudden it seems to correct itself after a second or so.I need to play with it a little bit to see how it behaves before I decide if I have to add a config for this or not, or if it should be enabled by default or not
I discovered similiarily weird behaviors as of today. Sometimes stuff begins loading slowly, I might be forced to toggle syntax and nvim-treesitter on and off sometimes.
I still cant figure out the reason behind that
Just a note, with the patch above (added to on_attach) breaks https://github.com/Wansmer/symbol-usage.nvim
I managed to fix this. There is a 4th parameter for client.request, buffer number, that also has to be passed. This is the updated snippet.
if not client.is_hacked_roslyn then
client.is_hacked_roslyn = true
-- let the runtime know the server can do semanticTokens/full now
if client.server_capabilities.semanticTokensProvider then
client.server_capabilities = vim.tbl_deep_extend("force", client.server_capabilities, {
semanticTokensProvider = {
full = true,
},
})
end
-- -- monkey patch the request proxy
local request_inner = client.request
client.request = function(method, params, handler, req_bufnr)
if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then
return request_inner(method, params, handler, req_bufnr)
end
local function find_buf_by_uri(search_uri)
local bufs = vim.api.nvim_list_bufs()
for _, buf in ipairs(bufs) do
local name = vim.api.nvim_buf_get_name(buf)
local uri = "file://" .. name
if uri == search_uri then
return buf
end
end
end
local doc_uri = params.textDocument.uri
local target_bufnr = find_buf_by_uri(doc_uri)
local line_count = vim.api.nvim_buf_line_count(target_bufnr)
local last_line = vim.api.nvim_buf_get_lines(target_bufnr, line_count - 1, line_count,
true)[1]
return request_inner("textDocument/semanticTokens/range", {
textDocument = params.textDocument,
range = {
["start"] = {
line = 0,
character = 0,
},
["end"] = {
line = line_count - 1,
character = string.len(last_line) - 1,
},
},
},
handler,
req_bufnr
)
end
end
While waiting for the PR to be merged in mason-registry, I created a custom registry that can be used to install roslyn from mason. Just add the registries
config to mason's setup and you will be able to install roslyn:
require('mason').setup({
registries = {
'github:mason-org/mason-registry',
'github:syndim/mason-registry'
},
})
While waiting for the PR to be merged in mason-registry, I created a custom registry that can be used to install roslyn from mason. Just add the
registries
config to mason's setup and you will be able to install roslyn:require('mason').setup({ registries = { 'github:mason-org/mason-registry', 'github:syndim/mason-registry' }, })
That's cool :) I currently just retain the last 15 releases which ammounts to 3-4 weeks regarding their current velocity. Do I need to explicitly retain the pinned version in your registry or do you plan to update every 2 weeks or sth. like this anyways ?
While waiting for the PR to be merged in mason-registry, I created a custom registry that can be used to install roslyn from mason. Just add the
registries
config to mason's setup and you will be able to install roslyn:require('mason').setup({ registries = { 'github:mason-org/mason-registry', 'github:syndim/mason-registry' }, })
That's cool :) I currently just retain the last 15 releases which ammounts to 3-4 weeks regarding their current velocity. Do I need to explicitly retain the pinned version in your registry or do you plan to update every 2 weeks or sth. like this anyways ?
I setup a bot to automatically update the package version. Currently it's sending PRs to the repo, will try to let the bot commit to the repo directly so no action will be needed.
@Syndim Hi! it seems your feed is out of sync with the microsoft feed - your feed hasn't had an update in 2 weeks. Do you know about this?
@Syndim Hi! it seems your feed is out of sync with the microsoft feed - your feed hasn't had an update in 2 weeks. Do you know about this?
I guess renovate isn't configured correctly. Roslyn bumped from 4.12 to 4.13.
Hi, I have a small patch to suggest for the semantic tokens. I can't clone or edit the wiki, so I'm doing it here. You only have to add some vim.fs.normalize
calls to find_buf_by_uri
to make it work on Windows file systems and with relative paths.
local function find_buf_by_uri(search_uri)
local bufs = vim.api.nvim_list_bufs()
local normalized_search_uri = vim.fs.normalize(search_uri)
for _, buf in ipairs(bufs) do
local name = vim.api.nvim_buf_get_name(buf)
local uri = vim.fs.normalize("file://" .. name)
if uri == normalized_search_uri then
return buf
end
end
end
Side note: The semantic highlighting seems to do a large amount of requests, noticeably slowing down everything after inserting some characters.
@Syndim Hi! it seems your feed is out of sync with the microsoft feed - your feed hasn't had an update in 2 weeks. Do you know about this?
@Syndim Hi! it seems your feed is out of sync with the microsoft feed - your feed hasn't had an update in 2 weeks. Do you know about this?
I guess renovate isn't configured correctly. Roslyn bumped from 4.12 to 4.13.
Fixed
Hi, I have a small patch to suggest for the semantic tokens. I can't clone or edit the wiki, so I'm doing it here. You only have to add some
vim.fs.normalize
calls tofind_buf_by_uri
to make it work on Windows file systems and with relative paths.local function find_buf_by_uri(search_uri) local bufs = vim.api.nvim_list_bufs() local normalized_search_uri = vim.fs.normalize(search_uri) for _, buf in ipairs(bufs) do local name = vim.api.nvim_buf_get_name(buf) local uri = vim.fs.normalize("file://" .. name) if uri == normalized_search_uri then return buf end end end
Side note: The semantic highlighting seems to do a large amount of requests, noticeably slowing down everything after inserting some characters.
I'll try to update the tips and tricks
Hi, I have a small patch to suggest for the semantic tokens. I can't clone or edit the wiki, so I'm doing it here. You only have to add some
vim.fs.normalize
calls tofind_buf_by_uri
to make it work on Windows file systems and with relative paths.
If you change find_buf_by_uri to vim.uri_to_bufnr, it will work on Windows too. I think it will be simpler.
local target_bufnr = find_buf_by_uri(params.textDocument.uri) ↓ local target_bufnr = vim.uri_to_bufnr(params.textDocument.uri)
Hi there
It's way too annoying to get the latest releases.
I built a public repository that will download new releases once a day.
Would you accept a PR where it'd check for updates and/or download install them directly like the old integration does with
:CSInstall
?