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

15702 Коммитов

Автор SHA1 Сообщение Дата
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
David Wengier b275b91b26 Rename some variables etc. 2024-09-09 14:12:06 +10:00
David Wengier fb2a2bd5e6 Fix broken tests
All tests pass!
2024-09-09 14:12:06 +10:00
David Wengier add718d35d Get all consuming code compiling again
Haven't run the tests yet :)
2024-09-09 14:12:06 +10:00
David Wengier f6da71dfdf Convert TextEdit to TextChange
This commit wasn't purely mechanical, but it was close. Just making things mostly compile, no optimizations or anything yet, and probably still a bunch more renames to come.
2024-09-09 14:12:05 +10:00
David Wengier b0cd007c25
Remove flaky test (#10854)
This keeps failing, and formatting it doesn't add any value to our
integration tests IMO
2024-09-09 11:05:24 +10:00
David Wengier 6186646fac Remove flaky test 2024-09-08 08:32:20 +10:00
Alex Gavrilov e9cd0b2e2e
OnAutoInsert Cohosting Tests (#10829)
* OnAutoInsert Cohosting Tests

* Fixing C# case (and correcting others)

All text should already be in the document/buffer when OnAutoInsert is being executed. Tigger character is not being added to the buffer, it should already be in the buffer.

* PR feedback

Switching to applying edit instead of verifying edit contents and range. Switching from Theories to separate Facts where input was complex. Other misc cleanup.

* Fixing options source and adding options tests

* Tests for all options

* Switching to use TestCode class

* Create options object for cohost OnAutoInsert to combined individual options passed to the remove service.

* More PR feedback

* Switching to nested RazorFormattingOptions
2024-09-06 22:31:13 +00:00
Dustin Campbell 5105d1b960 Update GetLanguageKind(...) tests and move to Workspaces.Test 2024-09-06 15:07:51 -07:00
Dustin Campbell ed8e62b920 Remove IDocumentMappingService.GetLanguageKind(...) 2024-09-06 15:01:01 -07:00
Dustin Campbell ae81c663bd Fix up tests that mocked IDocumentMappingService.GetLanguageKind(...) 2024-09-06 15:00:52 -07:00
Dustin Campbell f575ad02ca Add and use RazorCodeDocument.GetLanguageKind(...) extension method 2024-09-06 11:14:58 -07:00
Dustin Campbell e8eede823a Move GetLanguageKind(...) implementation methods to a helper class 2024-09-06 10:49:53 -07:00
David Wengier cc5b5a54ec One more, after the merge 2024-09-06 17:13:58 +10:00
David Wengier 9386c8c975 Merge remote-tracking branch 'upstream/main' into MinFix 2024-09-06 17:08:07 +10:00
David Wengier 07e138222c
Cohost Spell Check (#10825)
Needs https://github.com/dotnet/roslyn/pull/74978
Fixes https://github.com/dotnet/razor/issues/10746
Part of https://github.com/dotnet/razor/issues/9519
2024-09-06 16:05:27 +10:00