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

16780 Коммитов

Автор SHA1 Сообщение Дата
David Wengier 64910d5bea
Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2631041 (#11427) 2025-01-30 12:30:36 +11:00
dotnet bot 3f160cb17c Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2631041 2025-01-29 14:52:00 -08:00
David Wengier 3f44e60546
Fix typo in setting description (#11423) 2025-01-30 09:08:01 +11:00
Jordi Ramos 306439a42f
fuse on by default (#11425) 2025-01-29 20:09:48 +00:00
Jordi Ramos 5580dba076
Change recommended VS extension to ESLint (#11424) 2025-01-29 19:49:54 +00:00
David Wengier 5ea4ce40ec Fix typo in setting description 2025-01-29 09:18:10 -08:00
David Wengier 7ad7dc7264
Fix test again (#11420) 2025-01-28 15:55:42 +11:00
David Barbet bad8d77ba8
Update configs for 17.14 p2 (#11421)
### Summary of the changes

-

Fixes:
2025-01-27 18:01:35 -08:00
David Barbet 43575e8b40 Update configs after 17.14 p1 snap 2025-01-27 17:17:57 -08:00
David Wengier 03f64bf2aa
Merge branch 'main' into FixTestAgainForRealThisTimeISwearButDontHateMeIfImWrong 2025-01-28 11:56:39 +11:00
David Wengier c6510a731c Fix test again 2025-01-27 11:27:32 -08:00
David Wengier 54587bfee1
[main] Update dependencies from dotnet/source-build-reference-packages (#11419) 2025-01-28 01:48:58 +11:00
dotnet-maestro[bot] d9dd7b6f80 Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20250124.2
Microsoft.SourceBuild.Intermediate.source-build-reference-packages
 From Version 10.0.606501 -> To Version 10.0.607402
2025-01-27 05:01:32 +00:00
David Wengier 67d928ffdb
Turn on the new formatting engine by default (#11415) 2025-01-25 11:27:30 +11:00
David Wengier 8b25ff69c5 Turn on the new formatting engine by default in VS 2025-01-25 08:51:12 +11:00
David Wengier fae936e853 Revert "Fix test output"
This reverts commit 0004ea4835.
2025-01-25 08:36:10 +11:00
David Wengier aaaf768fe6
Don't create overlapping changes when doing additional formatting (#11413)
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2347107

First commit fixes the bug in the new formatting engine where we
sometimes create overlapping edits, and instead now we drop those edits
on the floor, so at least most of the file will format correctly.
Second commit then fixes the actual formatting issue with the code in
hand, which means we no longer have overlapping edits in the first
place.
2025-01-24 14:36:47 +11:00
David Wengier 941179d817 Language server tests are fussy 2025-01-24 14:05:06 +11:00
David Wengier c4e5153b96 More explain more good 2025-01-24 12:22:18 +11:00
David Wengier 3492e14a44 Ensure there is a newline after the close brace of a code block 2025-01-24 11:50:16 +11:00
David Wengier 979580cba6 Don't create overlapping changes when doing additional formatting 2025-01-24 09:06:07 +11:00
David Wengier e7119d562e
Fix test output (#11410)
I realised we could be waiting a while before the integration test
machines are updated and get the new formatting engine, so lets see some
green for a while. Easy enough to revert this PR once the test starts
failing again.
2025-01-23 16:42:37 +11:00
Chris Sienkiewicz 4b6227bb3f
Synchronize razor compiler assembly loading (#11394)
* Simplify. Just let roslyn always load the compiler assemblies.

* Update doc

* Update roslyn version

* Fix warnings introduced when multitargeting

---------

Co-authored-by: Fred Silberberg <fred@silberberg.xyz>
Co-authored-by: Jared Parsons <jared@paranoidcoding.org>
2025-01-22 19:56:07 -08:00
David Wengier 0004ea4835 Fix test output 2025-01-23 12:12:29 +11:00
Andrew Hall 08d80b6a31
Allow generate method to handle delegates (#11402)
Fixes #11380
2025-01-22 21:44:06 +00:00
Alex Gavrilov e9d10c2daa
Fix bad completion commit in vs code (#11398)
* Adding new flag to control commit characters specified in some of the Razor completion items

* Use the new flag to control commit characters specified for DirectiveAttributeTransitionCompletionItemProvider
2025-01-21 21:25:34 -08:00
Dustin Campbell 0e13d494d0
SourceTexts for Everyone! (#11404)
Fixes #8076

This is a change I've been planning for quite a while, and I'm hoping it
will have a positive impact on performance. Essentially, this does away
with that `CodeWriter.GeneratedCode`,
`RazorCSharpDocument.GeneratedCode`, and
`RazorHtmlDocument.GeneratedCode` returns a giant string. Instead, each
provides a way to get at a canonical `SourceText`. The `SourceText`
returned by `CodeWriter.GetText()` is produced efficiently by passing a
custom `TextReader` into `SourceText.From(...)`, and the new
`RazorCSharpDocument.Text` and `RazorHtmlDocument.Text` properties just
return the `SourceText` that `CodeWriter` produced.

In generally, I'm hoping this will reduce LOH allocations for large
Razor files. However, while moving code that had previously accessed
`GeneratedCode` to now use the `SourceText`, I found a few places to
make additional performance wins:

1. Any code that was comparing generated code can now do so efficiently
using `SourceText.ContentEquals(...)`
2. A number of places in tooling code were grabbing the `GeneratedCode`
property and passing it to `CSharpSyntaxTree.ParseText(...)`. These have
all been updated and many of them were updated to just call tooling's
`RazorCodeDocument.GetOrParseCSharpSyntaxTree(...)`, which caches the C#
`SytntaxTree`.

I focused on making the commit history high quality, so I recommend
reviewing commit-by-commit if that makes sense for you.

CI Build:
https://dev.azure.com/dnceng/internal/_build/results?buildId=2623654&view=results
Test insertion:
https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/604233
2025-01-21 13:22:18 -08:00
Dustin Campbell ba63de7b52
Handful of performance fixes (#11399)
This PR consists of a handful of performance fixes in the both the
compiler and tooling to try and improve the Speedometer regression in
Razor completion. I recommend reviewing commit-by-commit. The specifics
of each change is described in each commit.

CI build:
https://dev.azure.com/dnceng/internal/_build/results?buildId=2622490&view=results
Test insertion:
https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/603874
2025-01-21 13:17:18 -08:00
Dustin Campbell 0eeb66319a CodeWriter: Add missing nameofs to exception message 2025-01-21 11:46:11 -08:00
Dustin Campbell 70281f8bbe IntegrationTestBase: Pass TextSpan to SourceText.ToString(...) 2025-01-21 11:45:39 -08:00
Dustin Campbell 0c00564d76 DefaultRazorProjectFileSystem: Use CreateString() to avoid extra copying
Using `MemoryBuilder<char>` here results in extra copying over `StringExtensions.CreateString()`. (Spans are copied into the builder and then copied out to the final string.) So, `StringExtensions.CreateString()` is the better option.
2025-01-21 09:45:32 -08:00
Dustin Campbell facca63f45 Throw if RazorProjectItem.GetSource() returns null
Add a slightly paranoid null check in tooling. Currently, only `SourceGeneratorProjectItem.GetSource()` could return null and this code should never encounter a `SourceGeneratorProjectitem`.
2025-01-21 09:41:12 -08:00
Dustin Campbell a71cc2721f Improve RazorProjectItem.GetSource() implementations
- Use InterlockedOperations.Initialize(...) to ensure the same instance is always returned when accessed by multiple threads.
- Simplify SourceGeneratorProjectItem.GetSource().
2025-01-21 09:10:09 -08:00
Dustin Campbell f985b09ef3 Clarify comment 2025-01-21 08:58:35 -08:00
David Wengier 66fdab134f
[main] Update dependencies from dotnet/source-build-reference-packages (#11405)
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**: 20250115.1
- **Date Produced**: January 15, 2025 6:40:55 PM UTC
- **Commit**: be366997dfae0aa6e3c9a78bad10bfb3f79cbde1
- **Branch**: refs/heads/main

[DependencyUpdate]: <> (Begin)

- **Updates**:
-
**Microsoft.SourceBuild.Intermediate.source-build-reference-packages**:
[from 10.0.606004 to 10.0.606501][1]

[1]:
1d0bf11804...be366997df

[DependencyUpdate]: <> (End)


[marker]: <> (End:011df26a-fbd1-45b0-94b9-08db3601dcca)
2025-01-20 21:27:49 +11:00
dotnet-maestro[bot] 4d89d04674 Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20250115.1
Microsoft.SourceBuild.Intermediate.source-build-reference-packages
 From Version 10.0.606004 -> To Version 10.0.606501
2025-01-20 05:02:18 +00:00
Dustin Campbell 6fc5f2e0fc Replace CodeWriter.GenerateCode() with custom TextReader
This is a much more significant change that adds a custom TextReader to read the contents of CodeWriter's data structures. When passed to SourceText.From, it is used to either produce a StringText (by calling TextReader.ReadToEnd()) or, if the length is too large, a LargeText that wraps multiple arrays of chars rather than a giant string. The TextReader provides overrides of the methods that will ultimately be called by SourceText.From.
2025-01-18 10:46:20 -08:00
Dustin Campbell bc1b91d9d9 Fix ArrayExtensions AsSpan() and AsMemory() helpers
These were incorrectly defined to return ReadOnlySpan<T> and ReadOnlyMemory<T> but _should_ return Span<T> and Memory<T> to match the equivalent BCL methods.
2025-01-18 09:53:44 -08:00
Dustin Campbell e0d6317581 Stop calling CodeWriter.GenerateCode() in compiler tests
Update compiler tests to call CodeWriter.GenerateCode().ToString() instead.
2025-01-18 09:12:35 -08:00
Dustin Campbell 875c21e286 CodeWriter: Move Dispose closer to the constructor
This keeps set up and clean up code close by.
2025-01-18 06:58:49 -08:00
Dustin Campbell 745f700866 Remove GeneratedCode property altogether
This change removes the GeneratedCode property from IRazorGeneratedDocument, RazorCShaprDocument, and RazorHtmlDocument.
2025-01-18 06:55:05 -08:00
Dustin Campbell 1f5145ba84 Update test code to access Text rather than GeneratedCode 2025-01-18 06:55:05 -08:00
Dustin Campbell 71e88fe10c A few more updates to tooling code to avoid using GeneratedCode 2025-01-18 06:55:05 -08:00
Dustin Campbell c86080423a Avoid using GeneratedCode to parse C# syntax tress
This change adjusts lots of code in tooling to avoid accessing RazorCSharpDocument.GeneratedCode just to call CSharpSyntaxTree.ParseText(...). RazorCodeDocument has an extension method helper for this purpose that caches the result.
2025-01-18 06:55:05 -08:00
Dustin Campbell a2a3aa41be Update Legacy Editor shim IRazorCodeDocument.GeneratedCode
IRazorCodeDocument.GeneratedCode in the legacy editor shim has been changed to use RazorCSharpDocument.Text.ToString(). It caches the result to avoid constructing the string again on subsequent calls.
2025-01-18 06:55:05 -08:00
Dustin Campbell aa34973828 GeneratedDocumentTextLoader: Don't create a new SourceText
Instead of creating a new SourceText, GeneratedDocumentTextLoader.LoadTextAndVersionAsync(...) can just use RazorCSharpDocument.Text.
2025-01-18 06:55:05 -08:00
Dustin Campbell 8387481df7 Update tooling's GetCSharpSourceText() and GetHtmlSourceText() helpers
This change updates the GetCSharpSourceText() and GetHtmlSourceText() helpers to return GetCSharpDocument().Text and GetHtmlDocument().Text directly. They no longer cache objects on RazorCodeDocument.Items.
2025-01-18 06:55:05 -08:00
Dustin Campbell 6e6316d986 Improve RazorSourceGeneratorTests a bit
The RazorSourceGeneratorTests rely on an EventListener which can make them a challenge to debug.
During debug-time, it's for the EventListener to capture spurious events, resulting in
unexpected failures. This change adds a sanity check to ensure that the EventListener only
captures events from the expected source. In addition, the events are no longer captures in a
ConcurrentQueue, since the "queue-like" behaviors were never utilitized.
2025-01-18 06:49:29 -08:00
Dustin Campbell 11831e5686 RazorSourceGenerator: Use Text instead of GeneratedCode
Updates RazorSourceGenerator to use the RazorCSharpDocument.Text property rather than GeneratedCode.
This avoids some inefficiencies and removes some hidden allocations:

- Passing a SourceText to CSharpSyntaxTree.ParseText(...) means that it won't create a new SourceText under-the hood
  to wrap the generated code.
- SourceText.ContentEquals(...) can be used to compare the generated code instead of string.Equals(...).
- IncrementalGeneratorInitializationContext.AddSource(...) no longer needs creates new SourceText under-the-hood
  to wrap the generated code.

To ensure the SourceText has value equality when it flows through the incremental source generator, it's wrapped in a
record struct that compares with SourceText.ContentEquals(...)
2025-01-18 06:42:38 -08:00
Dustin Campbell 4af4ee9ce1 Introduce IRazorGeneratedDocument.Text property
This change adds a Text property to IRazorGeneratedDocument that returns SourceText. The GeneratedCode property will be removed in later commits.
2025-01-17 12:36:08 -08:00