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

file operation: like move,rename or delete seems not supported

Open Wordluc opened this issue 1 year ago • 4 comments

When I move a file from a/pippo.cs to a/b/pippo.cs and then move it back to a/pippo.cs, the LSP gives me this error: 'Ambiguity between 'method' and 'method', as if the file wasn't deleted during the first move.", this happend also if i create a file in a/pippo2.cs with inside 'method'

Wordluc avatar Aug 20 '24 09:08 Wordluc

hi @Wordluc do you move the file inside the editor or manually from the shell/finder/explorer? and which editor is it?

razzmatazz avatar Aug 21 '24 06:08 razzmatazz

hi, inside the editor, i use neovim

Wordluc avatar Aug 21 '24 07:08 Wordluc

anyway i think the problem is that the file aren't written (or deleted) inside csproj(no sdk)

Wordluc avatar Sep 27 '24 19:09 Wordluc

I'm having a similar issue in Neovim, but the ambiguity error occurs anytime I save a file. When I do, all my class-scoped members get flagged as ambiguous. What's odd is that the ambiguity is flagged reflexively — e.g.,

class Foo
{
  private int bar;
 
  private void useBar() 
  {
    for (var i = 0; i <= bar; bar++) // <- error occurs: "Ambiguity between 'foo.bar' and 'foo.bar'
    {
      Console.WriteLine($"{bar}"); // <- error occurs: "Ambiguity between 'foo.bar' and 'foo.bar'
    }
  }
}

Closing and reopening the buffer, or restarting the LSP via :LspRestart, removes the error temporarily, but saving the buffer, even if no changes were made, causes the error to return.

Update: explicitly calling csharp.solution = some_solution_name.sln seemingly resolves this issue. For those who used mason to install csharp-lsp, I was able to do so under nvim-lspconfig.opts.servers.csharp_ls.solution. For me, this is not an issue, as I rarely code in C#. However, it may be an issue for those who utilize it on a daily basis.

EZappala avatar Jan 20 '25 17:01 EZappala