Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal , Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Internal.Transport , Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Internal.Transport , Microsoft.AspNetCore.Razor.Internal.Transport , Microsoft.CodeAnalysis.Razor.Tooling.Internal
From Version 6.0.2-1.21602.2 -> To Version 6.0.2-1.21609.3
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
* Map SelectionRange for CodeActions requests
If a SelectionRange is provided it's required that the range
should also be mapped correctly before sending off the request
for code actions. This context is used for cases where code action
ordering is ordered and the original range may not actually be
equal to the SelectionRange. Both are needed to correctly provide
the right code fixes and/or refactorings and in the right order
from Roslyn
* tests... maybe?
* Spaysing
* naming
- Originally when this work was done I attempted to call the advise in the ctor; however, that in practice didn't work out so well. Therefore, given that the editor document manager is always "started" / requested elsewhere we can lazily advise the running document table when already on the UI thread.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1441597
* Update dependencies from https://github.com/dotnet/razor-compiler build 20211202.2
Microsoft.AspNetCore.Razor.Internal.Transport
From Version 6.0.1-servicing.21565.21 -> To Version 6.0.2-1.21602.2
* Use transport packages
- So turns out for customers who have moved their `obj` folders out of the solution directory (common for larger apps and done via the MSBuild `BaseIntermediateOutputPath` or `IntermediateOutputPath` property) and then published their app would break our ability to consume future Razor component / project system information. Turns out the `obj` folder + publish combo breaks due to a blatant bug in our `project.razor.json` change detection mechanism. Let me explain: Whenever a project has an `obj` outside of the workspace directory we need to notify the RZLS where to look for said `obj` folder so it can detect `project.razor.json` changes. We do this via a custom endpoint (`razor/monitorProjectConfigurationFilePath`) which takes in a csproj + `project.razor.json` path. So when a user would publish what the IDE would do is move the project to the `Release` configuration to build the app and then immediately move it back to the `Debug` configuration. This in turn would trigger two monitor project configuration file path events because the `Release` config has a different project.razor.json path (`obj/Release/net6.0/project.razor.json`), the two events would be "move to Release folder", "move back to Debug folder". Now the problem is that our caching mechanism in our monitor config endpoint would never update its `project.razor.json` path if it found we were moving from one `project.razor.json` path to another. Therefore, when we initially moved to the "Release" folder it'd start monitoring that folder; however, once we tried to move to the `Debug` folder it would never start a new watcher for the Debug folder; instead it would stop the release folder watching and then sit their twiddling its thumbs :D.
- Note: You can also reproduce this behavior by manually going to Debug -> Release -> Debug.
- Fix was to make it so when we moved from different `obj` folders to always stop/reconstruct the detectors no matter what.
- Added tests to validate that publish scenarios work as expected.
Fixes#5757
* Add project capability opt-out to use legacy Razor editor.
- In the past there were various opt-outs to force the .NET Core editor in non-.NET Core scenarios. When we moved to the LSP editor we lost some of these capabilities. This changeset re-adds a similar functionality.
For context see: https://github.com/dotnet/roslyn/discussions/54068
* Add comment.
* Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 1480205
* Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 1481798
* Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 1481940
* Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 1482438
* Fix HTML completion race when typing too quickly
- There was a race when typing too quickly our synchronization mechanism would try and reduce the work that was done to cancel pre-existing requests. So in the scenario when you were to type `<tr` what would happen is that 3 completion requests would fire:
1. Triggered completion for `<`
2. Typing completion for `t`
3. Typing completion for `r`
Now when we sped things up we were able to process requests in parallel which meant that we could handle simultaneous requests for `<`, `t` and `r` all at the same time; however, this in turn results in an interesting behavior where if we ask for completion at `r` while `<` and `t` are still active our synchronization mechanism would aggressively cancel the older requests. For completion this is catastrohpic because it would result in a 0 length completion list because HTML does not respect completion requests beyond trigger characters and the beginning of the word.
- To fix this issue I added a new mechanism for synchronization which takes a flag `rejectOnNewerParallelRequest` which states do not reject a synchronization request aggressively if this flag is `true`. Now this doesn't mean the requests never get rejected. If there's a batched document update or document close / open this will still reject the document; it just means that on the requesting of synchronization that older completion requests are not rejected eagerly.
- Added tests to our projection and synchronization stack to account for this
- Ensured that these changes are not breaking changes so marked some bits as virtual.
### Before
![before image](https://i.imgur.com/sZfGaub.gif)
### After
![after image](https://i.imgur.com/5EsJdDm.gif)
Fixes#5743
* Update src/Razor/src/Microsoft.VisualStudio.LanguageServer.ContainedLanguage/LSPDocumentSynchronizer.cs
Co-authored-by: Allison Chou <allichou@microsoft.com>
* Fix newer tests.
Co-authored-by: Allison Chou <allichou@microsoft.com>