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

15768 Коммитов

Автор SHA1 Сообщение Дата
dotnet-maestro[bot] f671158239 Update dependencies from https://github.com/dotnet/arcade build 20240911.2
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24461.1 -> To Version 8.0.0-beta.24461.2
2024-09-13 13:14:36 +00:00
dotnet-maestro[bot] 8aa16219f2 Update dependencies from https://github.com/dotnet/arcade build 20240911.2
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24461.1 -> To Version 8.0.0-beta.24461.2
2024-09-13 13:00:16 +00:00
Jan Jones 742f378c6a
Use Basic.Reference.Assemblies in MS.CA.Razor.Test (#10877)
* Use Basic.Reference.Assemblies in MS.CA.Razor.Test

* Improve code style
2024-09-13 09:54:03 +00:00
Jan Jones 120997fa75
Remove toolset compiler workaround (#10876) 2024-09-13 10:27:34 +02:00
David Wengier bce408a66d Move helper method to somewhere central 2024-09-13 14:03:43 +10:00
David Wengier b36d507968 More tests and better validation 2024-09-13 13:37:26 +10:00
David Wengier 851405f327 Remove static caches for export providers
Also delete all of the if-def-ed out and redundant code as a result. If we need to do any caching of things, lets just use xunit features and not odd static stuff with custom test attributes etc.
2024-09-13 13:37:26 +10:00
David Wengier f3062e7106 Have our test service dispose of its export provider 2024-09-13 13:37:26 +10:00
David Wengier 923c016bff Convert HtmlFormatting to a service, have it own its export provider, and create a fixture so we can still share an instance 2024-09-13 13:37:26 +10:00
David Wengier 8f7e1f8d7f Update all of the other tests 2024-09-13 13:37:26 +10:00
David Wengier 462d9a4ff4 Add diagnostics test
Writing the code: Easy
Writing the test: Easy
Getting the MEF stuff to work: I've lost even more hair
2024-09-13 13:37:25 +10:00
dotnet-maestro[bot] 55a86eaa77 Update dependencies from https://github.com/dotnet/arcade build 20240911.1
Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24460.4 -> To Version 8.0.0-beta.24461.1
2024-09-12 13:06:54 +00:00
dotnet-maestro[bot] 80f5130f9a Update dependencies from https://github.com/dotnet/arcade build 20240911.1
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24460.4 -> To Version 8.0.0-beta.24461.1
2024-09-12 13:01:35 +00:00
dotnet-maestro[bot] ad899a5071 Update dependencies from https://github.com/dotnet/arcade build 20240911.1
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24460.4 -> To Version 8.0.0-beta.24461.1
2024-09-12 12:48:53 +00:00
David Wengier 37ca607429 Combine, translate and report diagnostics from the OOP service
Also switch from Roslyn LSP types to VS LSP types so we can call the shared code
2024-09-12 08:16:31 +10:00
David Wengier 4736846c58 Move RazorDocumentConverter and RazorTranslateDiagnosticsService down to workspaces layer 2024-09-12 08:16:03 +10:00
Dustin Campbell 80a72817bf
Add Collection Best Practices in Razor document (#10861)
This change adds a new document covering some "collection best
practices" for the Razor repo. This can be expanded, but I think/hope
it's a good start.
2024-09-11 14:01:05 -07:00
Dustin Campbell 0d5879a1cb Tune up CollectionBestPractices.md based on review feedback 2024-09-11 11:44:44 -07:00
dotnet-maestro[bot] 23ad882408 Update dependencies from https://github.com/dotnet/arcade build 20240910.4
Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24459.4 -> To Version 8.0.0-beta.24460.4
2024-09-11 12:39:54 +00:00
dotnet-maestro[bot] 4750e0c38f Update dependencies from https://github.com/dotnet/arcade build 20240910.4
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24459.4 -> To Version 8.0.0-beta.24460.4
2024-09-11 12:35:09 +00:00
dotnet-maestro[bot] 0056636534 Update dependencies from https://github.com/dotnet/arcade build 20240910.4
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24459.4 -> To Version 8.0.0-beta.24460.4
2024-09-11 12:23:16 +00:00
David Wengier a782f9e8e3 Create basic service and endpoints to gather diagnostics and pass them over to OOP
Wanted to validate my Roslyn code would work first, before moving our services around, in case the order of this work seems backwards to usual :)
2024-09-11 16:50:50 +10:00
David Wengier 062682d321
Rename file (#10873)
Noticed this was wrong when browsing around during triage
2024-09-11 09:28:38 +10:00
Alex Gavrilov d8b0c49923
Cleanup default RemoteAutoInsertOptions (#10852)
* Using default constructor per David's suggestion to avoid having two copies of default values

* More PR feedback

* PR feedback - formatting
2024-09-10 23:23:08 +00:00
David Wengier 1f78fd1f69 Rename file 2024-09-11 07:53:33 +10:00
Dustin Campbell ac21c4df72
Add missing space
Co-authored-by: David Wengier <david.wengier@microsoft.com>
2024-09-10 08:12:08 -07:00
Dustin Campbell 665e11649c
Fix typo
Co-authored-by: Jared Parsons <jared@paranoidcoding.org>
2024-09-10 08:11:53 -07:00
Dustin Campbell a3fe4c96d9
Tweak text for consistency
Co-authored-by: Jared Parsons <jared@paranoidcoding.org>
2024-09-10 08:11:42 -07:00
dotnet-maestro[bot] b2afe51751 Update dependencies from https://github.com/dotnet/arcade build 20240909.4
Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24426.2 -> To Version 8.0.0-beta.24459.4
2024-09-10 13:43:23 +00:00
dotnet-maestro[bot] 9b3d543ccc Update dependencies from https://github.com/dotnet/arcade build 20240909.4
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24426.2 -> To Version 8.0.0-beta.24459.4
2024-09-10 13:22:59 +00:00
dotnet-maestro[bot] c108e637c2 Update dependencies from https://github.com/dotnet/arcade build 20240909.4
Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk
 From Version 8.0.0-beta.24426.2 -> To Version 8.0.0-beta.24459.4
2024-09-10 13:09:31 +00:00
David Wengier 2511efed42
Switch formatting engine over to using `TextChange` instead of `TextEdit` (#10855)
Fixes https://github.com/dotnet/razor/issues/10842

The formatting self-nerd-sniping continues.

The formatting engine was written to use the LSP `TextEdit` class, which
makes some sense, but also uses Roslyn APIs like `SourceText` a lot,
which uses the `TextChange` struct instead. This meant lots of code to
convert to and from the two types. Changing the whole formatting engine
over to `TextChange`, and using more `TextSpan`, `LinePositionSpan` etc.
removes a lot of this code. It also makes a lot more sense in cohosting,
to boot.

I wouldn't claim that I've gone through and improved the perf of the
formatting engine, but rather I've use the changes to lead me to things
that need fixing. ie, I started out moving from `TextEdit[]` to
`ImmutableArray<TextChange>`, and this let me to places where pooled
array builders could be used, and places where `Range` and `Position`
were used which didn't make much sense, and then the constructor for
`LinePosition` threw at one point because it turns out we were only
using the `Line` property from the `Position` that used to be used, and
so never validated the characters, so that API moved to `int`, etc.

TL;DR the commits tell the story, and there could well be something I
missed, if it never came across my plate for another reason.
2024-09-10 15:08:15 +10:00
David Wengier 05e317fc98 Fix after merge 2024-09-10 14:07:22 +10:00
David Wengier ef0054cbfb Merge remote-tracking branch 'upstream/main' into FormattingTextChange 2024-09-10 14:06:51 +10:00
David Wengier f9e09f5bbb
[main] Update dependencies from dotnet/source-build-reference-packages (#10858)
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**: 20240905.1
- **Date Produced**: September 5, 2024 10:13:43 PM UTC
- **Commit**: ad3c9aa85596f42c6a483233c50fab8cee8c412a
- **Branch**: refs/heads/main

[DependencyUpdate]: <> (Begin)

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

[1]:
6bcf90f99d...ad3c9aa855

[DependencyUpdate]: <> (End)


[marker]: <> (End:011df26a-fbd1-45b0-94b9-08db3601dcca)
2024-09-10 14:05:01 +10:00
David Wengier 4f1a297954 PR Feedback 2024-09-10 13:25:26 +10:00
Dustin Campbell 29c73023e7
Remove IDocumentMappingService.GetLanguageKind(...) and make it an extension method on RazorCodeDocument (#10851)
For a long while, the `GetLanguageKind(...)` method that determines
whether an index into a document falls within Razor, C# or HTML has been
a bit of a wart on the `IDocumentMappingService`. It really isn't part
of document mapping, and its implementation is completely distinct. In
fact, making the actual change is quite simple, so why hadn't it been
done yet? The answer is mocking.

There are several tests that mock
`IDocumentMappingService.GetLanguageKind(...)` to lie about test inputs.
In my not-so-humble opinion, this represents an abuse of mocking.
Instead of setting up tests to have the necessary inputs that ensure
`GetLanguageKind(...)` would return a real and correct result, the
inputs would often be garbage and an `IDocumentMappingService` mock
would lie about the `GetLanguageKind(...)` result at a particular
location. This makes moving `GetLanguageKind(...)` off of
`IDocumentMappingService` a much larger change than it needs to be. This
is why there are substantial test changes in this PR.

Don't misunderstand me as a mocking hater! Mocking libraries are
definitely useful! In fact, there are new mocks used in this very PR!
However, mocks should be used judiciously and thoughtfully, and in this
case, a mock was used to write lazy tests.

Fixes https://github.com/dotnet/razor/issues/8774
2024-09-09 16:21:28 -07:00
Dustin Campbell 8ffc0fc7d3 Add Collection Best Practices in Razor document 2024-09-09 15:39:38 -07:00
dotnet-maestro[bot] baabd8de45 Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240905.1
Microsoft.SourceBuild.Intermediate.source-build-reference-packages
 From Version 10.0.0-alpha.1.24428.1 -> To Version 10.0.0-alpha.1.24455.1
2024-09-09 12:43:40 +00:00
David Wengier 308833d8b8
Remove unused private members (#10848)
A clean error list is a good error list.
2024-09-09 18:58:19 +10:00
David Wengier 98421fada3 Fix auto insert service after merge from main 2024-09-09 16:42:50 +10:00
David Wengier d1857851fb PR Feedback 2024-09-09 14:19:52 +10:00
David Wengier 64786251c1 Use ImmutableArray in SourceTextDiffer too 2024-09-09 14:12:07 +10:00
David Wengier 04f2ca6f3c Create a helper method and revert change to shared code, just in case 2024-09-09 14:12:07 +10:00
David Wengier 4aeb51937b Convert HtmlFormatter to ImmutableArray<TextChange>
All callers did the conversion anyway
2024-09-09 14:12:07 +10:00
David Wengier b268c61db8 IEnumarable to ImmutableArray
Most places already passed an ImmutableArray here. I left the method itself being an iterator, as 50% of callers need an ImmutableArray result, but the other 50% need an array, so no clear winner.
2024-09-09 14:12:07 +10:00
David Wengier aec9af4b43 Remove some more usage of LSP types, and simplify ranges to line numbers 2024-09-09 14:12:07 +10:00
David Wengier 4e9bf4dc12 Use pooled collections in a few more spots 2024-09-09 14:12:07 +10:00
David Wengier f89e7f6ee9 Extract common code to helper method 2024-09-09 14:12:06 +10:00
David Wengier caa7ca0d99 Rename some methods to Try... pattern 2024-09-09 14:12:06 +10:00