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.82k stars 773 forks source link

Fix #14375 by showing and inserting correct name of entities from unopened namespace/module #17261

Closed Tangent-90 closed 1 month ago

Tangent-90 commented 1 month ago

Description

Extracted from #17252

Fixes part 2 of #14375

  1. For entity in class or module, instead of trying to open the class/module, it will now include the class/module name in DisplayName, so it won't try to open a class now. For modules, it will only try to open the nearest parent namespace/module.

GIF 2024-5-29 0-38-13

  1. It won't insert duplicated open now. And completions can now also be filter by class/module name.

GIF 2024-5-29 0-41-45

Checklist

github-actions[bot] commented 1 month ago

:heavy_exclamation_mark: Release notes required


:white_check_mark: Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/8.0.400.md
vsintegration/src docs/release-notes/.VisualStudio/17.11.md
Tangent-90 commented 1 month ago

I get what the issue is about, yet for some reason, I cannot reproduce the exact problem described in the bug. This PR has a bit different setting though - so could I ask you to also record a small "before" gif, how things currently look on your machine?

I have no other VS installation, so I record this GIF in VSCode (but it is the same bug).

GIF 2024-5-29 19-58-45

You can see that the class System.BitConverter or System.Collections.Immutable.ImmutableArray is opened, and it may insert a duplicated one though there is a same open. The former one is a bug in FCS, and the latter one is in editor extension(FSharp.Editor or fsautocomplete)

Tangent-90 commented 1 month ago

maybe we can add test to here

psfinaki commented 1 month ago

Yeah, let's try those ones. Note they have just moved to the Compiler.Service project, but haven't changed otherwise.

psfinaki commented 1 month ago

@Tangent-90 sorry it's taking this long - I am really trying my best to verify this. Among other things, it will be helpful when writing the release notes for VS.

I have checked out your branch and I am trying to repro the last example you've shared but seems like I am still getting the incorrect behavior:

https://github.com/dotnet/fsharp/assets/5451366/4b16a459-f8c2-468a-be69-8b8cf7cd2892

How does this look for you? And what could I be doing wrong?

Tangent-90 commented 1 month ago

@Tangent-90 sorry it's taking this long - I am really trying my best to verify this. Among other things, it will be helpful when writing the release notes for VS.

I have checked out your branch and I am trying to repro the last example you've shared but seems like I am still getting the incorrect behavior:

https://github.com/dotnet/fsharp/assets/5451366/4b16a459-f8c2-468a-be69-8b8cf7cd2892

How does this look for you? And what could I be doing wrong?

This pr is solving problem in completion list of unresolved symbols (press Ctrl+J in VS or Alt+Right). The bug show in your video is of the code fix, and I haven't try that before 😂.

psfinaki commented 1 month ago

@Tangent-90 sorry it's taking this long - I am really trying my best to verify this. Among other things, it will be helpful when writing the release notes for VS. I have checked out your branch and I am trying to repro the last example you've shared but seems like I am still getting the incorrect behavior:

Recording.2024-06-03.145038.mp4

How does this look for you? And what could I be doing wrong?

This pr is solving problem in completion list of unresolved symbols (press Ctrl+J in VS or Alt+Right). The bug show in your video is of the code fix, and I haven't try that before 😂.

Okay fair enough, I was looking at the wrong place :)

But now, hopefully, I am looking at the right place and still don't notice the change... Trying Ctrl + J here:

https://github.com/dotnet/fsharp/assets/5451366/1685f15f-ed8a-49d3-bf13-42bd65e42051

Tangent-90 commented 1 month ago

But now, hopefully, I am looking at the right place and still don't notice the change... Trying Ctrl + J here:

You may need to enable this option. This is disabled by default.

图片

And then you will get a very long completion list like this:

图片

psfinaki commented 1 month ago

Ohhhh I see now. Yeah that was it, now I see the difference. All good, thanks for the explanations and the testing!