dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.84k stars 776 forks source link

Interface renaming works weirdly in some edge cases #15399

Open psfinaki opened 1 year ago

psfinaki commented 1 year ago

WTF:

https://github.com/dotnet/fsharp/assets/5451366/779f4ddb-a6a9-4258-8c6e-d0573b1a6f67

WTF!!!!

https://github.com/dotnet/fsharp/assets/5451366/8f5f2d53-9d8e-4c05-a977-ed4cfd19fa98

Code:

type IFoo = abstract member Bar : unit -> unit

type Foo() = interface IFoo with member __.Bar () = ()

let foo = Foo() :> IFoo

One of the weirdest things I have seen in VS. Reproduces only on the last case. VS crash is caused when I try to move the cursor in the renaming window using the mouse.

vzarytovskii commented 1 year ago

Incremental renaming path (or whatever its called right now) is unstable, it's known.

psfinaki commented 1 year ago

It's just weird it happens only when renaming the interface after the cast. And that it crashes VS every time.

0101 commented 11 months ago

So this isn't related to interfaces, rather to renaming the last symbol in the file. And it also reproduces in C#, so not our fault this time!

psfinaki commented 11 months ago

Just wondering - can you post some C# code to get the same behavior? I am curious to reproduce.

0101 commented 11 months ago

@psfinaki sure, for example:

var hello = 1;
var x = hello;

Just create a console app and put it at the end of Program.cs. Then try to rename hello.

Top level statements have to be enabled (they are by default) so that you can get the symbol close enough to the end of the document.

psfinaki commented 11 months ago

Hah alright, confirmed. Yeah that's quite glaring, thanks :D

0101 commented 11 months ago

VS team triaged it. I should be notified when they fix it. Also it's probably not high impact, since renaming the last symbol in file is probably not as common :)