Skip to content

Conversation

@T-Gro
Copy link
Member

@T-Gro T-Gro commented Apr 13, 2023

SimplifyNames analyzer is responsible for reducing qualified names if the respective namespaces/modules are being opened.
However, it was not triggering most of the time.

This PR addresses this by reducing the lock contention of this service:

  • Adding timeout to waiting on SemaphoreSlim to prevent a never ending queue of requests
  • Increasing the bandwith to 3 operations at the same time
  • Giving up if the lock is not obtained

On top of that, when I was debugging, the project was treated as "FSharpMiscellaneous". Which meant regular .fs files (not scripts) were not analyzed in that situation:
if document.Project.IsFSharpMiscellaneousOrMetadata && not document.IsFSharpScript

@T-Gro T-Gro requested a review from a team as a code owner April 13, 2023 16:59
@T-Gro T-Gro changed the title Trigger SimplifyNames analyzer Improve when SimplifyNames analyzer is triggered Apr 13, 2023
@T-Gro
Copy link
Member Author

T-Gro commented Apr 13, 2023

/run fantomas

@github-actions
Copy link
Contributor

@majocha
Copy link
Contributor

majocha commented Apr 13, 2023

On top of that, when I was debugging, the project was treated as "FSharpMiscellaneous". Which meant regular .fs files (not scripts) were not analyzed in that situation:
if document.Project.IsFSharpMiscellaneousOrMetadata && not document.IsFSharpScript

Does this happen when opening a solution with preopened documents? I've seen VS creating temporary projects for open documents, it seems it happens before the solution is fully loaded or something. Do we want to run analyzers on those?

@T-Gro
Copy link
Member Author

T-Gro commented Apr 14, 2023

On top of that, when I was debugging, the project was treated as "FSharpMiscellaneous". Which meant regular .fs files (not scripts) were not analyzed in that situation:
if document.Project.IsFSharpMiscellaneousOrMetadata && not document.IsFSharpScript

Does this happen when opening a solution with preopened documents? I've seen VS creating temporary projects for open documents, it seems it happens before the solution is fully loaded or something. Do we want to run analyzers on those?

I have seen it even after dozens of seconds when debugging.
Here, it is still rate-limited by the SemaphoreSlim guard.

@abonie abonie merged commit 0737157 into dotnet:main Apr 14, 2023
@T-Gro T-Gro deleted the make-simplifyname-work-again branch October 17, 2023 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants