Граф коммитов

3244 Коммитов

Автор SHA1 Сообщение Дата
Andrew Hall f09dd68bcc
Map SelectionRange for CodeActions requests (#5844)
* 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
2021-12-09 13:55:04 -08:00
Sam Harwell 60e09d26fd
Merge pull request #5842 from sharwell/nullable-enable
Enable nullable reference types in solution (preserve all current semantics)
2021-12-07 21:02:28 -08:00
N. Taylor Mullen 27574343c5 Call AdviseRunningDocTableEvents on UI thread take 2.
- 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
2021-12-07 17:50:38 -08:00
N. Taylor Mullen 51d34f58a8 Revert "Call AdviseRunningDocTableEvents on UI thread. (#5783)" (#5832)
This reverts commit 1f785f416c.
2021-12-07 17:50:38 -08:00
Sam Harwell 512d369c02 Enable nullable reference types in solution (preserve all current semantics) 2021-12-07 14:38:00 -08:00
David Wengier c0f5921305
Merge pull request #5824 from davidwengier/FormatRenderFragment 2021-12-07 12:11:10 +11:00
David Wengier 44d8171c7c
Merge pull request #5817 from davidwengier/WrapWithDiv 2021-12-07 09:55:03 +11:00
Ryan Brandenburg 622536c54e
Nullable (#5821)
* Nullable
2021-12-06 14:45:24 -08:00
David Wengier 85cf979b20 PR feedback 2021-12-07 09:42:18 +11:00
Ryan Brandenburg 50687a4622
Disable C# classification from TextMate (#5794)
* Disable C# classification from TextMate
2021-12-06 14:38:34 -08:00
David Wengier 64f02499a7
Update src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs
Co-authored-by: Ryan Brandenburg <rybrande@microsoft.com>
2021-12-07 09:32:57 +11:00
Allison Chou ccfef3590e
Fix semantic tokens bug (#5823) 2021-12-06 13:55:28 -08:00
David Wengier 807a6f1fe9
Update src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs 2021-12-06 20:13:03 +11:00
David Wengier 16a8596c22 Fix render fragment formatting in C# blocks 2021-12-06 20:11:36 +11:00
David Wengier 938149d4c3 PR feedback 2021-12-05 21:53:35 +11:00
Pranav K fd0673153a
Update dependencies from https://github.com/dotnet/razor-compiler build 20211202.2 (#5815)
* 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
2021-12-03 11:29:44 -08:00
N. Taylor Mullen c1310fc2ed Fix Razor.VSCode.Grammar.Test component governance issues.
Addresses:
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/6063426?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/5469399?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/5469400?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/6063424?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/6063425?typeId=6437374
2021-12-03 10:24:38 -08:00
N. Taylor Mullen f355702976 Pin tar dependency to a good version for VSCode.Test
Addresses:
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/6063426?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/5469399?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/5469400?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/6063424?typeId=6437374
- https://dnceng.visualstudio.com/internal/_componentGovernance/dotnet-razor-tooling/alert/6063425?typeId=6437374
2021-12-02 23:18:15 -08:00
David Wengier f91c903c31 Div -> Tag 2021-12-03 15:25:52 +11:00
David Wengier bafc16b8e2 Create empty method to workaround platform bug 2021-12-03 15:25:52 +11:00
David Wengier 8a693528a4 Nullable 2021-12-03 15:25:52 +11:00
David Wengier ee8629cba6 Remove our command handler 2021-12-03 15:25:52 +11:00
David Wengier 4fad820735 Tests 2021-12-03 15:25:52 +11:00
David Wengier d6a77461c2 Use the same method name 2021-12-03 15:25:52 +11:00
David Wengier b7b7611a2d Initial implementation of WrapWithDiv command 2021-12-03 15:25:52 +11:00
N. Taylor Mullen 4376588099 Fix publish from breaking Razor component discovery.
- 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
2021-11-30 16:11:15 -08:00
Ryan Brandenburg 9acd76a548
Fix Nullable issues and Log Document Sync errors (#5777)
Nullable and logging
2021-11-30 16:07:51 -08:00
Ryan Brandenburg b1e47920b9
Set AttributeUsage (#5785) 2021-11-29 10:12:34 -08:00
N. Taylor Mullen 1f785f416c
Call AdviseRunningDocTableEvents on UI thread. (#5783)
* Call AdviseRunningDocTableEvents on UI thread.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1441597

* Actually switch to main thread....

* Add comment.
2021-11-25 01:44:28 +00:00
N. Taylor Mullen f7be11bb79
Add project capability opt-out to use legacy Razor editor. (#5781)
* 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.
2021-11-24 21:16:48 +00:00
dotnet bot f1e1f8f2dc
Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 1484164 (#5779) 2021-11-24 12:13:24 -08:00
David Wengier ff3cc36c5e
Merge pull request #5776 from davidwengier/DontFormatMultiLineStrings 2021-11-24 16:06:44 +11:00
David Wengier 6ebef15300 Don't look up ancestors unless necessary 2021-11-24 14:31:25 +11:00
Allison Chou bffca4810b
Remove Roslyn semantic tokens edit handling + switch to Roslyn range handling (#5769) 2021-11-23 11:28:14 -08:00
dotnet bot a3b5fdfaae
Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 1482438 (#5772)
* 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
2021-11-23 10:01:44 -08:00
David Wengier 6af51683b6 Don't format multi-line string literals 2021-11-23 21:56:36 +11:00
David Wengier 3ea22da72d
Merge pull request #5770 from davidwengier/AutomaticUsingDirectives 2021-11-23 20:40:52 +11:00
David Wengier fadfebfb0f Re-wrap parameters 2021-11-23 17:17:51 +11:00
David Wengier 497375d3b5 Put back null checks 2021-11-23 17:13:46 +11:00
N. Taylor Mullen 44040673ec
Fix HTML completion race when typing too quickly (#5744)
* 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>
2021-11-22 16:49:44 -08:00
David Wengier 2532f9bb7e Only process using statements when necessary 2021-11-22 09:35:54 +11:00
David Wengier f6ee0bc644 Always validate no edits when applicable 2021-11-22 09:35:53 +11:00
David Wengier 771e794da1 Fix up tests 2021-11-22 09:35:53 +11:00
David Wengier 49ba3817e4 Separate formatting methods into specific use cases 2021-11-22 09:35:53 +11:00
David Wengier 86d654a1cd Automatically add using statements if required 2021-11-22 09:35:53 +11:00
David Wengier b20d130d63 Change test to add using correctly 2021-11-22 09:35:53 +11:00
David Wengier 053cdd0070 Merge remote-tracking branch 'upstream/main' into CodeActionsEverywhere 2021-11-22 08:02:27 +11:00
N. Taylor Mullen 0f236b3b4e Address code review feedback. 2021-11-19 16:38:17 -08:00
N. Taylor Mullen 954c137bd8 Add better logging around project.razor.json handling.
- After digging through countless customer logs I've had a hell of a time finding out why Debug/Release project.razor.json's occasionally result in lack of component IntelliSense. This PR introduces logging to key points that will help investigate what's going on with #5757.
- We have two entry points on the Razor language server that deal with project.razor.json. These two are the `MonitorProjectConfigurationFilePathEndpoint` which is responsible for monitoring external project.razor.json locations (if you set your obj directory to something outside of the workspace) and the `ProjectConfigurationStateSynchronizer` which listens to `project.razor.json` file changes and then harvests information and pushes it to our language server project manager.
    - For these two I enabled nullability + added logging to better understand what's going on under the covers.

Part of #5757
2021-11-19 16:38:17 -08:00
Ryan Brandenburg 964f9bf479
More Nullable (#5756)
More Nullable
2021-11-19 16:10:04 -08:00