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

16322 Коммитов

Автор SHA1 Сообщение Дата
David Wengier b509f67d1c Fix code action translation to Roslyn types 2024-11-04 14:19:28 +11:00
David Wengier e829ffbb46 Add cohost resolve endpoint and tests 2024-11-04 14:19:16 +11:00
David Wengier 60ed8c036c Add delegated document Uri to code action data 2024-11-04 14:14:29 +11:00
David Wengier 61ca99bde7 Report better MEF composition errors in tests 2024-11-04 11:48:30 +11:00
David Wengier 1167bd95fa Extract base class from code actions tests
We were running most of them twice. Very confusing when you expect one test failure, but get two.
2024-11-03 14:54:10 +11:00
David Wengier ea1361b000 Override Range with SelectionRange in VS 2024-11-03 14:47:30 +11:00
Andrew Hall 123b17b69b
Fix some things for extract component (#11137)
Extract component had some odd behavior around MarkupTextLiteralSyntax selection.

Previously it would not allow a user to have a text literal as the start or end of the selection, it would always try to get the parent block. That works as intended for most cases where a user is highlighting inside a tag and the tag shouldn't be split. However, if the text is top level in the document it won't have a parent tag and thus would not have been considered a valid selection. This allows for that scenario.

There was also an issue if the selection was following a tag with a sibling text literal. If the selection ended after the brace but the text literal was not empty the selection would fail. For example:

```razor
[|<h1>Hello</h1>|]

Welcome to your new app
```

In the above the end of the selection is in the MarkupTextLiteralSyntax when it should be on the h1 node. A check for if the position was at the beginning of a text literal and it has a previous sibling was added to account for this.
2024-11-03 00:45:10 +00:00
David Wengier 70abe7163b
More CodeAction moves in preparation for cohosting (#11135)
Okay, I was wrong when I said the last PR was the final piece before
cohosting actually gets implemented, but this one is, I swear!

Code actions have to run in devenv for Roslyn, so the main thing here is
re-architecting so that the endpoints call the delegated servers,
because calling into the service. Each commit is an isolated step on the
way.
2024-11-02 08:51:08 +11:00
Ankita Khera c37ef3927a
Update PublishData.json (#11136)
updates publishdata after snap
2024-11-01 13:32:24 -07:00
Ankita Khera 63906862a5
Update PublishData.json 2024-11-01 12:34:17 -07:00
Dustin Campbell 3adf6fef61
Pre co-hosting Hover tweaks (#11131)
This pull request makes a couple of changes to
`HoverFactory.GetHoverAsync(...)` to prepare for co-hosting:

1. `HoverFactory.GetHoverAsync(...)` returns an LSP `Hover` rather than
`VSInternalHover`.
2. `HoverFactory.GetHoverAsync(...)` no longer takes a document file
path. It already takes a `RazorCodeDocument`, and the file path can be
retrieved from that.
2024-11-01 10:19:17 -07:00
David Wengier 6f61999a44 Complete cohosting code actions functionality 2024-11-01 18:08:19 +11:00
David Wengier 3376535870 Create basic cohosting infrastrcuture 2024-11-01 16:58:42 +11:00
David Wengier 5799539786 Resolve C# and Html code actions before calling the service
As before, cohosting will need to do this in devenv
2024-11-01 16:45:04 +11:00
David Wengier 1f0fd94ae4 Make method static
No need for cohosting to have to import a service for one method (in devenv)
2024-11-01 16:45:04 +11:00
David Wengier 623b3b48b0 Get C# and Html code actions before calling the service
Cohosting needs to get code actions in devenv, and will use the service in OOP
2024-11-01 16:45:04 +11:00
David Wengier d96a9ded3d Add language to RazorCodeActionContext 2024-11-01 16:45:04 +11:00
David Wengier 99e3034c17 Use a test accessor 2024-11-01 16:45:04 +11:00
David Wengier 6e5c580f2f Extract capabilities to a central place 2024-11-01 16:45:03 +11:00
Alex Gavrilov 6ff656614e
Adding client capabilities to OOP client initialization data (#11129)
* Add RemoteClientCapabilities service

The service gets initialized once during initial connection / init and provides client capabilities to other remote services.

* Add RemoteClientCapabilitiesService
- Adding client capabilities to RemoteClientLSPInitializationOptions
- Converting IRemoteClientIntializationService to be a JSON service for simplicity of data serialization
- Converting client initialization code to use JSON client to call IRemoteClientIntializationService

* Fixing tests

* Removing unneeded class

* Fixing tests

* Export IClientCapabilitiesService and consume it when appropriate

Only consumers that are initializing capabiilities service by calling SetCapabilities should be importing it via RemoteClientCapabilitiesService. All other consumers should be using IClientCapabilitiesService.

* Simplifying code, moving and correcting comment

* Test fixup per PR feedback

* Service rename per PR feedback

* More PR feedback

- Renaming a variable
- Made UpdateClientLSPInitializationOptions mode complete (so it updates RemoteSemanticTokensLegendService now with initialization data)
- Removed limitation of single update on RemoteSemanticTokensLegendService
- Use UpdateClientLSPInitializationOptions  in cohost semantic tokens test

* Removed unused service
2024-11-01 00:38:05 +00:00
Andrew Hall 09cba53db5
Fix aggregate telemetry reliability (#11134)
Currently telemetry is flushed after the language server host exits in VS Code. This is correctly flushing to the telemetry session, but can miss actually reporting the telemetry. In VS the lifetime of the TelemetrySession is managed centrally, but in VS Code it is up to each process to make sure it gets disposed properly. Without this telemetry that is fired could be dropped. This change addresses this by doing the following:

Removing the flush method on ITelemetryReporter
Making TelemetryReporter IDisposable (again). This will be disposed by the DI container.
Keep the DI container (ExportProvider) alive in rzls until the language server host exits.
This should fix the reliability of some telemetry getting dropped. It still won't fix the scenario where the user force closes the process but better aligns VS and VS Code in expectation of lifetime management.

I noticed this while trying to set up dashboards. There are not nearly as many events as would be expected. If this still continues to be an issue one more option would be to flush on a timer. The data itself is aggregated and should handle that nicely.
2024-11-01 00:29:44 +00:00
David Wengier 17eec6578b
Pass `DisposalToken` in tests (#11127)
Random pet peeves on a Thursday evening.
2024-11-01 08:09:17 +11:00
David Wengier 59d3de55ad
Make "add using" code actions high priority (#11128)
Fixes https://github.com/dotnet/razor/issues/11049

Turns out https://github.com/dotnet/razor/pull/11069 meant the ordering
of Razor and C# code actions is no longer a problem, so all we need to
do is make sure the code actions that introduce new `@using` directives
comes first.
2024-11-01 08:07:21 +11:00
Dustin Campbell 155e3c9243 Remove documentFilePath parameter from HoverFactory.GetHoverAsync(...)
The document file path can be retrieved from the RazorCodeDocument parameter.
2024-10-31 10:13:41 -07:00
Dustin Campbell b2e5bc8850 Return Hover from HoverFactory instead of VSInternalHover 2024-10-31 10:04:41 -07:00
Dustin Campbell 05f1ef684b Fix tests by setting up mocks with CancellationToken.None
These tests had been changed to set up mocks with DisposalToken from the testing infrastructure. However, the product code being tested doesn't have access to that CancellationToken and always passes CancellationToken.None to the method being mocked.
2024-10-31 09:06:00 -07:00
David Wengier d331eb77e9 Fix tests 2024-10-31 22:24:34 +11:00
David Wengier 4ab51017e8 Make extract component low priority 2024-10-31 22:14:52 +11:00
David Wengier 7c4094f148 Just because they're tests, doesn't mean we can't use proper cancellation tokens 2024-10-31 21:20:32 +11:00
David Wengier 4bf2470b12
docs: better bootstrapping xp (#11124)
### Summary of the changes

- optimize docs for first-time pull-experience

Fixes:
Some initial confusion when starting to work with the repo
2024-10-31 20:52:05 +11:00
dotnet bot b7255b89ef
Merge release/dev17.13 to main (#11125)
This is an automatically generated pull request from release/dev17.13
into main.


Once all conflicts are resolved and all the tests pass, you are free to
merge the pull request. 🐯

## Troubleshooting conflicts

### Identify authors of changes which introduced merge conflicts
Scroll to the bottom, then for each file containing conflicts copy its
path into the following searches:
- https://github.com/dotnet/razor/find/release/dev17.13
- https://github.com/dotnet/razor/find/main

Usually the most recent change to a file between the two branches is
considered to have introduced the conflicts, but sometimes it will be
necessary to look for the conflicting lines and check the blame in each
branch. Generally the author whose change introduced the conflicts
should pull down this PR, fix the conflicts locally, then push up a
commit resolving the conflicts.

### Resolve merge conflicts using your local repo
Sometimes merge conflicts may be present on GitHub but merging locally
will work without conflicts. This is due to differences between the
merge algorithm used in local git versus the one used by GitHub.
``` bash
git fetch --all
git checkout -t upstream/merges/release/dev17.13-to-main
git reset --hard upstream/main
git merge upstream/release/dev17.13
# Fix merge conflicts
git commit
git push upstream merges/release/dev17.13-to-main --force
```
2024-10-31 01:34:18 +01:00
David Wengier c5babf1368
[FUSE] Fix OnAutoInsert and override completion and possible others (#11122)
Fixes https://github.com/dotnet/razor/issues/11112
Hopefully fixes
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2290299/ but I'm
not sure, as whilst OnAutoInsert was definitely broken for me, it didn't
cause that repro. It just sent telemetry for a fault and did nothing in
the IDE.
Fixes
https://developercommunity.visualstudio.com/t/Razor-editor-is-broken-in-1712-Preview-/10777527
~but awaiting confirmation that FUSE is on for the user who reported the
issue (@richardhauer I don't suppose that's you?)~
Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2294069

Sadly, in order to get a working test for this, I had to enable FUSE in
cohosting. I say sadly because whilst it proves the cohosting tests are
awesome, it does potentially break us into jail a little bit. But only
in cohosting, so it's a pretty small jail :)

The changes aren't very exciting, as this is just
https://github.com/dotnet/razor/pull/10967 but for more than code
actions (and these changes probably should have been part of that PR
originally 🤦‍♂️), but each commit has an explanation for why it's there
so commit-at-a-time might be enlightening. I could not resist a little
clean up, but what's one little deleted service between friends?
2024-10-31 10:08:38 +11:00
David Wengier 5838cd55c9 More FUSE test coverage 2024-10-31 09:41:53 +11:00
David Wengier 9f60585428 Remove IFormattingCodeDocumentProvider
Since this service was written, IDocumentSnapshot has been updated such that now, all implementations just passed true for a parameter that is part of the existing API
2024-10-31 09:41:53 +11:00
David Wengier 03a0e2285e Fix guard clause, and failure result
This was returning the passed in changes, which were for a C# document, when the formatting engine should be producing changes for the Razor document, so that was wrong. Additionally, the guard itself was wrong
2024-10-31 09:41:53 +11:00
David Wengier f959a9a4da Make sure we get the right code document and pass it in
Previously this was using a boolean flag that I thought was the correct pivot point, but I was wrong, and it made things very confusing. This is much clearer, and more importantly, correct. Essentially if we are trying to format and we get passed a C# edit, then we can't force design time or it would be a different document than the original edit came from, if FUSE is on.
2024-10-31 09:41:53 +11:00
David Wengier 9b7ed904a7 Create failing test
Sadly, to get this far I had to opt cohosting into FUSE, which will have untold consequences
2024-10-31 09:41:53 +11:00
earloc f40133a61c
Update docs/contributing/BuildFromSource.md
Applying suggestion from code-review

Co-authored-by: Andrew Hall <ryzngard@live.com>
2024-10-30 23:16:40 +01:00
Dustin Campbell 51c7d56350
Push hover logic to Workspaces layer (#11119)
This change moves all of the logic that computes a `VSInternalHover` to
the Workspaces layer. The file diff shouldn't be too bad, but a lot of
code is moved without much additional clean up. So, it might be easier
to go commit-by-commit.
2024-10-30 14:29:42 -07:00
earloc 191e62e338 fix: duplicate newline as error 2024-10-30 21:48:58 +01:00
Dustin Campbell aa3209ad0e Remove superfluous argument null checks 2024-10-30 13:45:26 -07:00
Dustin Campbell 31eacc3e0d Add back SingleServerSupport check that was accidentally removed awhile ago 2024-10-30 13:41:51 -07:00
earloc 165d4168a4 docs: explain how to potentially get rid of `path-too-long`-errors 2024-10-30 20:29:00 +01:00
earloc e6ce7ae383 docs: format to better spot command-lines to execute while bootstrappin' 2024-10-30 20:14:50 +01:00
earloc ee96fe79ba doc: mention need for 'long-path'-support 2024-10-30 20:13:03 +01:00
Alex Gavrilov 41693dec1d
Update Roslyn package references to latest available and do minor fixup (#11113)
* Update Roslyn package references to latest available and do minor fixup

* Updating Versions.Details.xml to match Versions.props

* PR suggestion

* Fixing test failures

Roslyn was requesting new IRazorMappingService and our TestRazorDocumentServiceProvider was throwing. Returning null for now per suggestion from Andrew.

* Adding TODO comment per code review
2024-10-30 06:08:43 -07:00
Dustin Campbell e638ab6dcd Fix up HoverFactoryTest 2024-10-29 16:27:06 -07:00
Dustin Campbell b8a139270f Remove HoverService from the language server
Now that the implementation of GetHoverAsync has moved to Workspaces, HoverService really doesn't need to carry on.
2024-10-29 16:27:06 -07:00
Dustin Campbell 494e0f3df5 Move GetHoverAsync tests to Workspaces
Moving the existing hover tests requires a few test infrastructure changes.
2024-10-29 16:27:05 -07:00
Dustin Campbell 908ed82584 Move GetHoverAsync implementation to Workspaces 2024-10-29 16:27:05 -07:00