-
Notifications
You must be signed in to change notification settings - Fork 847
Workaround for emptying FSharp.Editor cache due to duplicate ProjectSystem events #13313
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
vzarytovskii
merged 3 commits into
dotnet:release/dev17.3
from
vzarytovskii:sources-cache-workaround
Jun 17, 2022
Merged
Workaround for emptying FSharp.Editor cache due to duplicate ProjectSystem events #13313
vzarytovskii
merged 3 commits into
dotnet:release/dev17.3
from
vzarytovskii:sources-cache-workaround
Jun 17, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KevinRansom
approved these changes
Jun 16, 2022
Member
Author
|
Converting to draft, since I will need to do some extensive manual testing before merging. |
Contributor
|
Undrafting. |
psfinaki
approved these changes
Jun 17, 2022
vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
Outdated
Show resolved
Hide resolved
vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
Outdated
Show resolved
Hide resolved
…e.fs Co-authored-by: Petr Semkin <psfinaki@users.noreply.github.com>
…e.fs Co-authored-by: Petr Semkin <psfinaki@users.noreply.github.com>
Member
Author
|
OK, I have verified that it works (there's still some lag between opening the document and colouring kick in, but it's most likely due to my slow laptop). |
KevinRansom
pushed a commit
to KevinRansom/fsharp
that referenced
this pull request
Jun 27, 2022
…ystem events (dotnet#13313) Co-authored-by: Petr Semkin <psfinaki@users.noreply.github.com>
vzarytovskii
added a commit
to vzarytovskii/fsharp
that referenced
this pull request
Jun 28, 2022
…ystem events (dotnet#13313) Co-authored-by: Petr Semkin <psfinaki@users.noreply.github.com>
vzarytovskii
added a commit
that referenced
this pull request
Jun 29, 2022
vzarytovskii
added a commit
that referenced
this pull request
Jun 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Workaround, until we have a proper fix from the project system or move to Roslyn as a source of truth:
Do not update cache if we receive completely empty list from project system.
A workaround for #12982.
More details:
When we open the solution,
HandleCommandLineChangesis getting called by project system (CPS):fsharp/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs
Lines 347 to 365 in 12c8309
When project system calls us, it sends us project id, source files and options, and we store them in cache:
fsharp/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs
Lines 540 to 541 in 12c8309
Project system calls us here:
https://github.com/dotnet/project-system/blob/2d8184bf78a11568ae502597ed5ba6d24bdd736c/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/LanguageServices/FSharp/FSharpCommandLineParserService.cs#L83-L94
Notification, apparently, originates from here:
https://github.com/dotnet/project-system/blob/9815fdcba096f21ae64a0dd1803d61b21b0c8b62/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/LanguageServices/Handlers/CommandLineNotificationHandler.cs#L26-L33
We use that cache afterwards, to get documents from it and then apply colouring, tooltips, etc.
However, what's happening now is:
HOWEVER those events contain empty source file list as well as options list, and we are rewriting the cache with empty lists.