csharp-language-server icon indicating copy to clipboard operation
csharp-language-server copied to clipboard

Lsp keep reload the project

Open Wordluc opened this issue 1 year ago • 6 comments

with this opt local cap = vim.tbl_deep_extend("force", vim.lsp.protocol.make_client_capabilities(), require('cmp_nvim_lsp').default_capabilities() ) cap.workspace.didChangeWatchedFiles.dynamicRegistration = true

Lsp reload all the project(saying that is changed .sln) even thought i had not changed anything.

image

ps:i use didChangeWatchedFiles to notify the server when i delete a file

Wordluc avatar Jun 10 '24 11:06 Wordluc

it seems that lsp dosnet support file operations, for this i use "didChangeWatchedFiles"

Wordluc avatar Jun 10 '24 15:06 Wordluc

Hey @Wordluc which OS is this?

razzmatazz avatar Jun 12 '24 06:06 razzmatazz

Windows 10

Wordluc avatar Jun 12 '24 06:06 Wordluc

for now i found this solutions:

cap.workspace.didChangeWatchedFiles.dynamicRegistration = true
local oldMath = require("vim.lsp._watchfiles")._match

require("vim.lsp._watchfiles")._match = function(a, b)
	if string.find(b, '.csproj') or string.find(b, '.sln') then
		return false
	end

	return oldMath(a, b)
end

Wordluc avatar Jun 12 '24 08:06 Wordluc

Hi @Wordluc , change to .csproj detected, will reload solution means the client tells the server that some csproj files are changed. Could you please share the trace log of which files are in the workspace/didChangeWatchedFiles? I guess there are some csproj files are in it.

From the workaround you shared, I think the client you are using sends unchanged files in workspace/didChangeWatchedFiles.

And from lsp spec, it's better to watch file changes in client side and client should send the changed files to server.

tcx4c70 avatar Jun 12 '24 09:06 tcx4c70

@tcx4c70 without the workaround are present diffent .csproj, the thing is that i don't change them, so like you said it's a problem of the client so nvim lsp? or is there something that "change" or "save" some csproj?

Wordluc avatar Jun 12 '24 10:06 Wordluc

the problem is that i use visual studio to build and debug the solution since visual studio open .sln to load the solution

Wordluc avatar Jul 04 '24 07:07 Wordluc