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

16189 Коммитов

Автор SHA1 Сообщение Дата
Andrew Hall 78bafebff2
Fix format on paste data readon from request (#11176)
It turns out the value comes back as a JsonElement instead of the underlying type 🤷
2024-11-07 13:47:31 -08:00
Dustin Campbell cdd0fdc87f
Update breaking change docs titles (#11178)
Mirror the changes in dotnet/roslyn#75789

See dotnet/AspNetCore.Docs#33996
2024-11-07 11:20:26 -08:00
Jan Jones c382522edc
Re-apply "Some random clean up and improvements (#11095)" (#11177) 2024-11-07 18:06:23 +01:00
Bill Wagner f262b917de Update breaking change docs titles
Mirror the changes in dotnet/roslyn#75789
2024-11-07 10:16:09 -05:00
David Wengier 40d2a6f1e6
Cohost code actions (#11147)
Fixes https://github.com/dotnet/razor/issues/10742
Needs https://github.com/dotnet/roslyn/pull/75711 before it will build
Also will need to merge in main once
https://github.com/dotnet/razor/pull/11141 is merged
2024-11-07 22:22:17 +11:00
David Wengier 390aced03b
Halve the time it takes to run formatting unit tests (#11173)
Turns out the boolean parameter passed in here is read in exactly one
spot in our code, and that line of code is never hit in these tests
because they use mocks.

Yes, this is the equivalent of removing a `Thread.Sleep` that was put in
previously, but I'm taking it regardless :)
2024-11-07 11:34:46 +11:00
David Wengier 31469c41cb Further tweak Roslyn helpers 2024-11-07 11:27:53 +11:00
David Wengier 6745d9b021 Halve the time it takes to run formatting unit tests 2024-11-07 10:40:47 +11:00
Dustin Campbell e87f30d14b
Add cohosting Hover test for component attribute (#11171)
Even though component attributes look like HTML they map to generated
C#. In this case, Hover prefers C# over HTML and requests hover data
from Roslyn. This adds a test for that scenario.
2024-11-06 14:36:21 -08:00
Alex Gavrilov c6c3190965
Fixing html snippet completion and intergration tests (#11172)
HTML snippet completions were being included when they shouldn't have been
2024-11-06 13:35:25 -08:00
David Wengier aebf195d9d Tweak roslyn helpers and nullability 2024-11-07 08:32:16 +11:00
Dustin Campbell a28edaf22b Add cohosting Hover test for component attribute
Even though component attributes look like HTML they map to generated C#. In this case, Hover prefers C# over HTML and requests hover data from Roslyn. This adds a test for that scenario.
2024-11-06 09:21:40 -08:00
dotnet bot 6e796fe6f1
Merge release/dev17.13 to main (#11170)
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-11-06 07:34:46 +01:00
David Wengier 6cd3c632d6 Fix namespace on test 2024-11-06 16:35:25 +11:00
David Wengier 15c03334ae Fix registration after merge 2024-11-06 16:35:16 +11:00
David Wengier 706dc9362c FIx code actions resolve in VS.
Lost hours to that bloody capital T
2024-11-06 16:35:05 +11:00
dotnet bot f3a99f74df
Merge release/dev17.13 to main (#11167)
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-11-06 05:02:14 +01:00
David Wengier 04da68965e Merge remote-tracking branch 'upstream/main' into dev/dawengie/CodeActionsPart5 2024-11-06 14:41:19 +11:00
Phil Allen 05e142e9a7
Revert "Some random clean up and improvements (#11095) (#11169)
Revert "Some random clean up and improvements (#11095) for dev17.13
2024-11-05 19:19:52 -08:00
David Wengier 61b5d93d9e PR Feedback 2024-11-06 14:17:32 +11:00
Dustin Campbell 57966530bf
Add co-hosting support for hover (#11150)
Fixes #10839

Now that all of the infrastructure is in place, adding a co-hosting
endpoint and remote service for Hover is mostly boilerplate. Similar to
the signature help endpoint, the result type might be a Roslyn LSP Hover
or a VS LSP Hover. The remote service always returns a Roslyn LSP Hover,
but HTML will return a VS LSP Hover. So, we join the possibilities
together with a SumType.
2024-11-05 18:07:22 -08:00
David Wengier bcb8166b9c
[main] Update dependencies from dotnet/source-build-reference-packages (#11148)
This pull request updates the following dependencies

[marker]: <> (Begin:011df26a-fbd1-45b0-94b9-08db3601dcca)
## From https://github.com/dotnet/source-build-reference-packages
- **Subscription**: 011df26a-fbd1-45b0-94b9-08db3601dcca
- **Build**: 20241030.1
- **Date Produced**: October 30, 2024 8:56:21 PM UTC
- **Commit**: 136e43e45e20bd58bf86eeabba0a0fa7e1a4b3ae
- **Branch**: refs/heads/main

[DependencyUpdate]: <> (Begin)

- **Updates**:
-
**Microsoft.SourceBuild.Intermediate.source-build-reference-packages**:
[from 10.0.0-alpha.1.24521.1 to 10.0.0-alpha.1.24530.1][1]

[1]:
ccd0927e38...136e43e45e

[DependencyUpdate]: <> (End)


[marker]: <> (End:011df26a-fbd1-45b0-94b9-08db3601dcca)
2024-11-06 12:04:03 +11:00
phil-allen-msft 594c89a235 Revert "Some random clean up and improvements (#11095)"
This reverts commit 76cd92a65e, reversing
changes made to a37ee126f8.
2024-11-05 17:00:29 -08:00
Dustin Campbell be89fc9876 Update CohostHoverEndpoint.GetRegistrations signature 2024-11-05 16:51:48 -08:00
Dustin Campbell 2358aa35fc Merge branch 'main' into cohost-hover 2024-11-05 16:43:54 -08:00
David Wengier 1eb70347c6 Merge remote-tracking branch 'upstream/release/dev17.13' into merges/release/dev17.13-to-main 2024-11-06 11:27:31 +11:00
Dustin Campbell ca2c656ed8
Improvements for Assumed.Unreachable(...) (#11155)
This change is a follow-up to
https://github.com/dotnet/razor/pull/11144#discussion_r1828602406 that
addresses two issues that may help with diagnosis:

1. `Assumed.Unreachable(...)`captures the `[CallerFilePath]` and
`[CallerLineNumber]` but didn't do anything with them. Now, those values
are appended to the exception message.
2. Two `Assumed.Unreachable(...)` overloads have been added to allow a
custom exception message to be provided that can be used to add more
detail about a failure.
2024-11-05 15:52:35 -08:00
David Wengier fe3286518d
Add some unit tests to validate cohosting configuration (#11151)
These tests detect an issue I ran into doing code actions, and Dustin
ran into doing hover.

Also makes it impossible to forget to specify a `DocumentSelector` in a
registration.
2024-11-06 10:31:27 +11:00
David Wengier 7069cc1cde Update endpoint after merge 2024-11-06 09:17:09 +11:00
David Wengier 9b2adb4cde
Revert "Update project configuration from Roslyn info (#11092)" (#11165)
This reverts commit a37ee126f8, reversing
changes made to ad74439384.

We'll have to do another dual insertion into VS Code too, I guess
2024-11-06 09:10:34 +11:00
David Wengier 51930c7d6c Merge remote-tracking branch 'upstream/main' into CohostEndpointTests 2024-11-06 09:01:43 +11:00
David Wengier c9391637d8 Revert "Update project configuration from Roslyn info (#11092)"
This reverts commit a37ee126f8, reversing
changes made to ad74439384.
2024-11-06 08:27:12 +11:00
Dustin Campbell 3b2adab82a Debug.Fail(...) if we encounter a language that we don't expect 2024-11-05 13:23:16 -08:00
David Wengier 26ca8d1fb5
Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2575448 (#11154)
This is the pull request automatically created by the OneLocBuild task
in the build process to check-in localized files generated based upon
translation source files (.lcl files) handed-back from the downstream
localization pipeline. If there are issues in translations, visit
https://aka.ms/icxLocBug and log bugs for fixes. The OneLocBuild wiki is
https://aka.ms/onelocbuild and the localization process in general is
documented at https://aka.ms/AllAboutLoc.
2024-11-06 07:57:18 +11:00
Dustin Campbell a3a4ff5798 Simplify RemoteHoverService logic
Rework the logic in RemoteHoverService. It isn't necessary to try and map the host document index to C#, since `GetPositionInfo(..., preferCSharpOverHtml: true)`already does that for us.
2024-11-05 09:47:18 -08:00
Dustin Campbell b4c31c6136 Merge branch 'main' into cohost-hover 2024-11-05 09:00:29 -08:00
Dustin Campbell 78405664f3 Improvements for Assumed.Unreachable(...)
This change addresses two issues that may help with diagnosis:

1. `Assumed.Unreachable(...)`captures the `[CallerFilePath]` and `[CallerLineNumber]` but didn't do anything with them. Now, those values are appended to the exception message.
2. Two `Assumed.Unreachable(...)` overloads have been added to allow a custom exception message to be provided that can be used to add more detail about a failure.
2024-11-05 08:44:45 -08:00
dotnet bot 704ebc231c Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2575448 2024-11-05 12:51:46 +01:00
dotnet bot 696e5792a1 Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2575448 2024-11-05 12:50:33 +01:00
David Wengier 39138ebe7c Merge remote-tracking branch 'upstream/main' into dev/dawengie/CodeActionsPart5 2024-11-05 22:11:54 +11:00
David Wengier 73383932d3 Update compiler test baselines 2024-11-05 22:09:48 +11:00
dotnet bot 903855f40b Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2575420 2024-11-05 11:33:25 +01:00
dotnet bot f09ab8256d Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2575420 2024-11-05 11:32:12 +01:00
Alex Gavrilov d0a5326f2b
Adding cohost completion handler (#11048)
* Basic infrastructure and HTML completion

* Moving CompletionListCache into common code

* Moved RazorCompletionListProvider and supporting infrustructure to common code

* Adding OOPRazorCompletionFactsService and moving MarkupTransitionCompletionItemProvider to common layer.

* Moving LspTagHelperCompletionService to common layer

* Move RazorCompletionListProvider to the Workspaces layer

* Add OOP MEF exports for completion services from Workspaces layer needed by RemoteCompletionService

* Hook up RazorComplelistListProvider in the RemoteCompletionService

Switch passed in and returned types from Roslyn to VS Platform LSP types since that's what all of the common completion code in the Workspaces layer uses. We will need to convert returned Roslyn completion items to VS platform LSP completion items.

* Bump Roslyn version to get new CSharp completion APIs

* Hooking up C# completion API

* Common code for completion trigger characters and correct character set used in cohosting

* Respect AutoShowCompletion setting in cohosting

* Move IsValidTrigger method to CompletionTriggerCharacters class in the workspaces layer (to be used in cohosting later)

* Call HTML completion only if we are in HTML and pass a set of existing HTML completion item labels to RazorCompletionListProvider

* Pass C# existing completion item labels to RazorCompletionListProvider and minor cleanup

* Final completion list merge logic

* Move delegated completion helper RewriteContext method into Workspace layer and use it in cohost completion request

* Provisional completion support

* Moving delegated response rewriters to the common layer

* Consuming delegated completion response re-writers in C#

Also simplifying parameters passed to the response re-writers to only what's needed.

* Switch to Roslyn CompletionParams as request input so converters are hooked up and we are getting VSInternalCompletionContext in CompletionParams

* Splitting delegated response rewriters into C# and HTML and simplifying them
They all already checked (or should've checked) for language and were operating on either C# or HTML, never on both. HTML re-writer will get called from the client and can be much simpler. In cohosting it doesn't make sense to have them all in one list since C# will get called in OOP and HTML on the client (in VS).

* Moving ShouldIncludeSnippets helper into the common layer and hooking it up in cohosting

* Adding snippets completion support to cohosting

* First part of completion options clean-up

Renamed some fields and variables dealing with "add snippets" options and added comments. We currently have two options that mean "add snippets" - one for the delegated completion, and one for Razor completion. The values of those don't correlate. The Razor one is always true in LSP and Cohost, always false for legacy editor. The delegation one actually depends on the position.

* Second part of completion options clean-up - fixing options values in cohost

* First set of tests

* Adding directives completion provider and test to cohost

* Adding directive and directive attribute completion providers and tests

Also adding a snippet completion provider test and markup transition test

* Adding test for CommitElementsWithSpace option

* Adding test for AutoInsertAttributeQuotes

* Moved most of the tests for moved code from LanguageServer to Workspaces test projects

The tests were left behind (some in this PR, some in prior PRs) when the code was moved to Workspaces layer. This commit addresses most of them other than in Delegation subworkspace

* Fixing delegated response re-writer tests.

We had inconsistent handling of null completion item labels between our response re-writers. Some handled null labels, others would through. Since label shouldn't be null (non-nullable), I adjusted the tests not to use null labels.

Also the tests previously passed because they created DelegatedCompletionListProvider with only a selected DelegatedResponseRewriter. Now the DelegatedCompletionHelper will apply all response re-writers for the correct language (either C# or HTML), which is what the product actually does, so I feel that's fine. It exposed these test failures due to inconsistent null label handling

* Add required cancellation token argument to GetGeneratedDocumentAsync in RemoteCompletionService

* Simplifying trigger character data

Switching AllTriggerCharacters to string[] since we only use it for registration/capability data, which needs string[]. and we never do look ups via Contains. Also removing rendundant property and calculations in CompletionListProvider

* Serialization attribute clean-up

* Converting DelegatedCSharpCompletionResponseRewriter to interface per CR suggestion

* Changing ShouldIncludeSnippets to take in RazorCodeDocument per CR suggestion

* Removed unnecessary null checks per CR suggestion

* PR feedback - ConfigureAwait(false), shared code for commit characters, better collection check

* Simplify applying provisional text edit

* PR test suggestions

* Adding a comment clarifying the reasoning about the return value of OOP code

* Removing item count verification and retries per PR feedback

* Switching to hardcoded directive list in tests per PR feedback

* Moving TagHelperServiceTestBase back to LanguageServer.Test project

This should probably move to the common test project eventually, but not in this PR. Moving this to the workspaces layer caused many changes in unrelated test files and changed test project references. Per PR feedback leaving this in the LanguageServer.Test project for now. We can refactor later as appropriate.

* Cleanup per PR feedback

* Fixing build post-merge

* Pass argument for supportsVsExtensions in RemoteDocumentSymbolService

Hardcoding true for now until we plumb this through Initialize. Fixes osolete API build break

* Add Debug.Fail to make the intent of returning null vs empy completion set more obvious

* Cleanup and comments per PR feedback

* One more comment per PR feedback

* Don't avertise Resolve until we provide it

* Removing unnecessary async

* C# override test

* Use remote IClientCapabilitiesService

Instead of passing client capabilities with each call to RemoteCompletionService we can now use remote IClientCapabilitiesService that's initialized with client capabilities on initial connection.

* Misc cleanup per PR feedback
2024-11-05 02:28:36 -08:00
Jan Jones f89cf41c61
Update to macOS-14 (#11153) 2024-11-05 11:13:48 +01:00
David Wengier 673f828e94 Seal endpoints (silly mistake 2?) 2024-11-05 16:29:14 +11:00
David Wengier 9b09b2508c Update tests. No idea why these weren't failing to compile on my machine before. I blame VS 2024-11-05 16:26:30 +11:00
David Wengier a217d9fabf Merge remote-tracking branch 'upstream/main' into dev/dawengie/CodeActionsPart5
# Conflicts:
#	src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/CodeActions/CodeActionsService.cs
2024-11-05 16:18:10 +11:00
David Wengier 4ef1668cd0 Bump Roslyn to 4.13.0-2.24554.8 2024-11-05 16:17:17 +11:00
David Wengier 0359bb30b9 Validate LSP methods are unique 2024-11-05 14:50:10 +11:00