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

15185 Коммитов

Автор SHA1 Сообщение Дата
David Wengier 9044af2a6d
Unskip and fix rename integration tests (#10722) 2024-08-10 09:32:00 +10:00
Jared Parsons cd1f82be21
Move to central package pinning (#10716)
* Move to central package pinning

This should make it much easier for us to respond to CG alerts in the
future. All that will need to be done is add an entry in
Directory.Packages.props and it will automatically impact all consumers
of it.

Consider this example in Roslyn for how to respond to a CG issue

https://github.com/dotnet/roslyn/pull/74653
2024-08-09 15:26:39 -07:00
David Wengier ed8dceef5c Try to fix rename tests 2024-08-09 21:43:33 +10:00
David Wengier 4441e1da03 Unskip rename tests 2024-08-09 21:43:26 +10:00
David Wengier 4bbedc61a7 Fix after rebase 2024-08-09 12:30:20 +10:00
David Wengier 1297fea58a Extract some common code 2024-08-09 11:31:36 +10:00
David Wengier ef49d716d3 Fix up tests because sometimes you ask Visual Studio to compile and it decides to skip a few things 2024-08-09 11:31:36 +10:00
David Wengier ee44c75030 Rename TryGetTextDocumentChanges to something better, and cleanup, and remove duplicate 2024-08-09 11:31:36 +10:00
David Wengier 3308f4f4fc Add C# rename test 2024-08-09 11:31:36 +10:00
David Wengier 6e0bb7004f Move EditMappingService, and create Remote and Lsp versions that do document lookups 2024-08-09 11:31:36 +10:00
David Wengier fb8702671f Add component rename test to validate Razor behaviour 2024-08-09 11:31:36 +10:00
David Wengier 7d514b3faf Add rename endpoint 2024-08-09 11:31:36 +10:00
David Wengier c1e718153e Sync the ReturnCodeActionAndRenamePathsWithPrefixedSlash flag to OOP 2024-08-09 11:31:36 +10:00
David Wengier 47665e0d26 Create a remote rename service, and dependencies, to perform the rename 2024-08-09 11:31:36 +10:00
David Wengier f3881562f7 Cleanups and tweaks 2024-08-09 11:31:35 +10:00
David Wengier 17671b6cde Extract rename functionality to a separate service 2024-08-09 11:31:35 +10:00
David Wengier d5cfe11b00
Don't pass `RazorCodeDocument` and `SourceText` around together (#10719)
because it's really easy to get one from the other.

While working on rename in cohosting, I noticed this unnecessary extra
bit of work while calling `GetPositionInfo`, so I fixed it. Then I
thought I'd see where else `GetSourceTextAsync` was used in an non-ideal
way, and that was clearly going to be too big for the rename PR so I
separated it out into it's own PR. Then I heard Dustin say he was
changing `DocumentSnapshot` so the unnecessary work will end up being
much less wasteful anyway, plus we'd probably just have conflicts, so I
pared the whole thing right back to just this minor removal of a couple
of unnecessary parameters. Enjoy.
2024-08-09 09:15:19 +10:00
David Wengier 79b2d26a80 I spent 10 minutes looking up cool Mr Freeze catch phrases for this commit message, and I didn't like any of them. 2024-08-09 08:46:36 +10:00
Dustin Campbell 9f6c7b6186 Clean up CompilationTagHelperResolver 2024-08-08 13:16:01 -07:00
Dustin Campbell 5fbfc0d454 Clean up all ITagHelperDescriptorProviders a bit (and found a bug!)
- Enable nullability
- Mark all as sealed
- Use `Lazy<T>` for singleton `ITagHelperDescriptorProviders`
- Introduce `TagHelperDescriptorProviderBase`
- Inherit from `TagHelperDescriptorProviderBase`
- Remove unnecessary properties
- Remove unnecessary property setters

In addition, I spotted a bug in `EventHandlerTagDescriptorProvider` while addressing nullability warnings. The buggy code is right here:

fb84ae5d9b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs (L70-L76)

When reading the constructor arguments of an `EventHandlerAttribute` it appears that we swap the last two arguments of the 4-argument variant. The constructor is defined like so:

```C#
EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault);
```

Unfortunately, the compiler reads the third parameter as `enablePreventDefaeult` and the fourth parameter as `enableStopPropagation`.

This has been broken since support for the 4-argument constructor variant was added in 7635bba6ef. Fixing this bug is tracked by https://github.com/dotnet/razor/issues/10497.
2024-08-08 12:28:46 -07:00
Dustin Campbell eae0d53793 Make ExcludeHidden and IncludeDocumentation init-only properties 2024-08-08 10:19:35 -07:00
Dustin Campbell 9476634170 Swap TagHelperDescriptorProviderContext.Create methods for constructors 2024-08-08 10:14:05 -07:00
Dustin Campbell 45625bc1a2 Remove TagHelperDescriptorProviderContext.Items property
This can be safely removed now that there are no more references.
2024-08-08 10:09:29 -07:00
Dustin Campbell ec5cd16335 Make TargetSymbol a TagHelperDescriptorProviderContext property 2024-08-08 10:07:39 -07:00
Dustin Campbell adff92a959 Make Compilation a TagHelperDescriptorProviderContext property
Every single `TagHelperDescriptorProviderContext` created in Razor compiler or tooling code adds a valid compilation. So, adding the compilation to the `ItemsCollection` is pure overhead and no `ITagHelperDescriptorProvider` needs to check it for null.

I removed a single test that verified the behavior if a compilation was never set. Now that a compilation is required, this test is no longer needed.
2024-08-08 10:05:46 -07:00
Dustin Campbell 53ec3abbf2 Merge TagHelperDescriptorProviderContext and DefaultContext 2024-08-08 09:44:38 -07:00
David Wengier 00e584a722 Don't pass code document and source text around in diagnostics translator, plus some cleanup 2024-08-08 21:15:00 +10:00
David Wengier 2c0e2528ae Remove unnecessary parameter, because it can be trivially retrieved 2024-08-08 17:03:26 +10:00
David Wengier f9c15e44b5
Add simple telemetry to initialize endpoint (#10715)
Adds a single telemetry point so that we if we receive feedback that
something unusual behavior occurs, we can determine if Fuse was engaged
or not engaged.
2024-08-08 10:01:22 +10:00
Dustin Campbell fb84ae5d9b
Co-hosting: Add API for mapping a generated document URI and range back to the host document (#10712)
There's a fair amount of refactoring here, but I was careful to separate
everything. So, I recommend reviewing commit-by-commit.
2024-08-07 16:06:53 -07:00
David Wengier e817d39020 PR feedback 2024-08-08 09:03:56 +10:00
Fredric Silberberg b5c4983ae5 Upgrade System.Security.Cryptography.Xml to avoid CG alerts. 2024-08-07 11:42:31 -07:00
Fredric Silberberg f8c1f4552d Update System.Formats.Asn1 to address CG alert. 2024-08-07 11:42:31 -07:00
Dustin Campbell a2c21cfac5 Find razor document correctly in RemoveDocumentMappingService 2024-08-07 09:22:07 -07:00
Dustin Campbell 358c2bfdc6 Add extension methods that convert URIs to Roslyn file paths 2024-08-07 09:22:01 -07:00
phil-allen-msft f65c6b609a Add simple telemetry to initialize endpoint 2024-08-06 22:00:13 -07:00
Dustin Campbell e4a6932dfc Use Uri.LocalPath rather than GetAbsoluteOrUNCPath() 2024-08-06 17:25:17 -07:00
Dustin Campbell 50a3d417da Move MapToHostDocuementUriAndRangeAsync to extension methods
This change also removes the `AbstractDocumentMappingService.TryGetCodeDocumentAsync(...)` method that was added in an an early commit.
2024-08-06 17:01:49 -07:00
Dustin Campbell fc6aa07bc2 Fix small typo in comment 2024-08-06 16:21:42 -07:00
Dustin Campbell 20dd630ed9 Remove unused DocumentState method 2024-08-06 16:16:14 -07:00
Dustin Campbell 655a88c400 Clean up RemoteDocumentSnapshot a bit 2024-08-06 16:13:58 -07:00
dotnet bot a11f5d78b0
Merge release/dev17.8 to release/dev17.10 (#10710)
This is an automatically generated pull request from release/dev17.8
into release/dev17.10.


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.8
- https://github.com/dotnet/razor/find/release/dev17.10

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.8-to-release/dev17.10
git reset --hard upstream/release/dev17.10
git merge upstream/release/dev17.8
# Fix merge conflicts
git commit
git push upstream merges/release/dev17.8-to-release/dev17.10 --force
```
2024-08-06 15:17:54 -07:00
Dustin Campbell a550cbb536 Remove remote DocumentContextFactory 2024-08-06 14:38:33 -07:00
Fredric Silberberg 47438b5bdc
Merge remote-tracking branch 'upstream/release/dev17.8' into merges/release/dev17.8-to-release/dev17.10
* upstream/release/dev17.8:
  Manually reference Microsoft.IO.Redist 6.0.1 where needed to fix CG alerts.
  Upgrade testing analyzers to address CG alert.
2024-08-06 14:08:05 -07:00
Fredric Silberberg 6353caa493 Manually reference Microsoft.IO.Redist 6.0.1 where needed to fix CG alerts. 2024-08-06 13:57:04 -07:00
Fredric Silberberg 085aa328ba Upgrade testing analyzers to address CG alert. 2024-08-06 13:57:04 -07:00
Dustin Campbell 58161c0f0d Rename RazorDocumentMappingService to LspDocumentMappingService 2024-08-06 13:21:12 -07:00
Dustin Campbell d5dc280eae Rename IRazorDocumentMappingServiceExtensions to IDocumentMappingServiceExtensions 2024-08-06 13:13:59 -07:00
Dustin Campbell f3f3ac7fa7 Rename AbstractRazorDocumentMappingService to AbstractDocumentMappingService 2024-08-06 11:59:44 -07:00
Dustin Campbell e3d92581f2 Rename IRazorDocumentMappingService to IDocumentMappingService 2024-08-06 11:58:56 -07:00