Skip to content

Fix #16761 #17047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 17, 2024
Merged

Fix #16761 #17047

merged 4 commits into from
Apr 17, 2024

Conversation

vzarytovskii
Copy link
Member

Description

Fixes #16761. Still missing navigating to specific range (at least I think so, needs more testing). Also not very easy to test this thing, since interop suite is nightmare to write and run locally.

TL;DR - now roslyn uses different MEF interface for navigation for F#, which before didn't have an ability to navigate to externals, this adds it - by navigating to external doc explicitly and not returning back metadata to roslyn. It also makes sure we initiate navigation on the UI thread, so we can grab needed VS services.

It's kinda a dirty workaround for the issue, but hey, it fixes navigation.

@vzarytovskii vzarytovskii requested a review from a team as a code owner April 15, 2024 16:24
Copy link
Contributor

github-actions bot commented Apr 15, 2024

❗ Release notes required

@vzarytovskii,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format.

The following format is recommended for this repository:

* <Informative description>. ([PR #XXXXX](https://github.com/dotnet/fsharp/pull/XXXXX))

See examples in the files, listed in the table below or in th full documentation at https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

You can open this PR in browser to add release notes: open in github.dev

Change path Release notes path Description
vsintegration/src docs/release-notes/.VisualStudio/17.11.md No release notes found or release notes format is not correct

if not res then
return ImmutableArray.empty
else
// TODO: return something? Maybe cancelled task?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think cancelled task would be any better here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure tbh what would be a good return value here.

Copy link
Member

@T-Gro T-Gro Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty immarray feels appropriate.
It probably is an errornous situation, but might as well come from stale data.

Idea:
Send this situation to telemetry reporter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty immarray feels appropriate.

Empty array will lead to message which will say something like "failed to find symbol", or it leads now.

It probably is an errornous situation, but might as well come from stale data.

Not really. We return empty array when we didn't find anything. In case of external navigation, we need to handle it ourselves and somehow tell Roslyn "nothing found but it's fine", that's why I thought of cancelled task - we cancel Roslyn navigation and deal with it ourselves.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you are right, I misread to which branch this belongs.
I meant to log telementry in case we did not find anything ourselves.

If we did find it, cancelling it seems like a good approach, indeed.

@vzarytovskii
Copy link
Member Author

vzarytovskii commented Apr 17, 2024

So, two things

  1. Returning empty result seems to work fine even when we managing navigation ourselves.
  2. Using provided cancellation token seems to be "cancelled" once we navigating inside the document. Not using it seems to work fine.

@T-Gro @psfinaki @KevinRansom are you okay with points above? Meaning if I leave them as I described?

I'm personally okay with not using CT inside the document. LSP will have different implementations for both internal and external implementations.

@dotnet dotnet deleted a comment from github-actions bot Apr 17, 2024
vzarytovskii and others added 2 commits April 17, 2024 17:43
  Co-authored-by: vzarytovskii <1260985+vzarytovskii@users.noreply.github.com>
@dotnet dotnet deleted a comment from github-actions bot Apr 17, 2024
@KevinRansom
Copy link
Contributor

Yes I'm fine with that.

@KevinRansom KevinRansom merged commit 587bc1e into dotnet:main Apr 17, 2024
psfinaki added a commit that referenced this pull request Apr 18, 2024
* Disallow calling abstract methods directly on interfaces (#17021)

* Disallow calling abstract methods directly on interfaces

* More tests

* IWSAMs are not supported by NET472

* Update src/Compiler/Checking/ConstraintSolver.fs

Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>

* fix typos

* looking for the right check

* Add comments

* move release notes

* Add a new error number and message

* Update docs/release-notes/.FSharp.Compiler.Service/8.0.400.md

Co-authored-by: Brian Rourke Boll <brianrourkeboll@users.noreply.github.com>

* Update docs/release-notes/.FSharp.Compiler.Service/8.0.400.md

Co-authored-by: Brian Rourke Boll <brianrourkeboll@users.noreply.github.com>

* Improve error message

---------

Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: Brian Rourke Boll <brianrourkeboll@users.noreply.github.com>

* Always use `typeEquivAux EraseMeasures` (for  integral range optimizations) (#17048)

* Always use `typeEquivAux EraseMeasures`

* Update release notes

* Update baselines

---------

Co-authored-by: Petr <psfinaki@users.noreply.github.com>

* Error message that explicitly disallowed static abstract members in classes. (#17055)

* WIP

* Error message that explicitly disallowed static abstract methods in abstract classes

* release notes

* SynTypeDefnKind.Class

* Fix #16761 (#17047)

* Fix #16761

* Fully async version + ignore cancellation on external navigation

* Automated command ran: fantomas

  Co-authored-by: vzarytovskii <1260985+vzarytovskii@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: Edgar Gonzalez <edgar.gonzalez@fundourselves.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: Brian Rourke Boll <brianrourkeboll@users.noreply.github.com>
Co-authored-by: Petr <psfinaki@users.noreply.github.com>
Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
@kerams
Copy link
Contributor

kerams commented Apr 21, 2024

I'm getting unwanted navigation when holding Ctrl and hovering over operators like && or >. Not sure if caused by this PR or a bug in VS.

@vzarytovskii
Copy link
Member Author

I'm getting unwanted navigation when holding Ctrl and hovering over operators like && or >. Not sure if caused by this PR or a bug in VS.

This pr didn't make it to any product preview yet. It should be 17.11

@kerams
Copy link
Contributor

kerams commented Apr 21, 2024

I have built my own VSIX from main.

@vzarytovskii
Copy link
Member Author

I have built my own VSIX from main.

Then it might be happening if roslyn calls us in this case. We don't initiate any navigation ourselves. Might check it when I have time later this week. @kerams could you please create an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Navigate to external metadata doesn't work
5 participants