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

14983 Коммитов

Автор SHA1 Сообщение Дата
Andrew Hall (METAL) 4f89cb348f Move flag passing 2024-07-17 15:33:29 -07:00
Dustin Campbell aed8cfaa5c Add MemoryBuilder<T> helper 2024-07-17 15:28:12 -07:00
Dustin Campbell 8d9b438270 Use ArgHelper in CodeWriter 2024-07-17 15:20:49 -07:00
Andrew Hall 281a652217
Remove binary test (#10639)
Now that we're not writing to disk, we don't need to validate previously generated files.

Fixes #10209
2024-07-17 15:17:40 -07:00
Dustin Campbell 6f3fcc1a80 Use CreateString helper in CodeWriter 2024-07-17 15:17:22 -07:00
Dustin Campbell 32fed2e24e Add StringExtensions.CreateString(...) helper 2024-07-17 15:07:06 -07:00
Dustin Campbell 8b0fe3dac1
Expand string and span extension methods (#10629)
This change covers several pieces of work on shared extension methods:

1. Augment and document `AsSpan()`, `AsSpanOrDefault()`, `AsMemory()`,
and `AsMemoryOrDefault()` extension methods targeting string.
2. Augment and document `Contains()`, `IndexOf()`, `StartsWith()`, and
`EndsWith()` extension methods targeting string.
3. Add `AsSpan()` and `AsMemory()` extensions methods targeting array
and Razor's polyfill `Index` and `Range` types.
2024-07-17 11:33:28 -07:00
Dustin Campbell 8e007c693d
Fix handful of unit test issues and the intermittent IndexOutOfRangeException failures (#10635)
It's probably easiest to go through this commit-by-commit.

The main fix here is the `IndexOutOfRangeException` in the
`FilePathNormalizer`. The problem occurs when the array rented from the
pool already contains a `\` or `/` immediately after the span that we
care about. It was possible for
`FilePathNormalizer.NormalizeAndDedupeSlashes(...)` to read past the end
of the span, and if it found a `\` or `/` there, it would cause the
incorrect length to be used later, causing an
`IndexOutOfRangeException`. The reason the failure was intermittent is
because it's dependent on the contents of the array pool.
2024-07-17 10:58:50 -07:00
Jan Jones c0b9aa27c6
Handle `:get`/`:set` in `EditorRequired` checking (#10628)
* Add utility for verifying razor diagnostics

* Handle `:get`/`:set` in `EditorRequired` checking

* Simplify code
2024-07-17 10:06:30 +02:00
David Wengier 0a42f3cfd9 Fail in a more interesting way 2024-07-17 17:18:34 +10:00
David Wengier 5a0a0b0de7 Updates after merge 2024-07-17 15:13:16 +10:00
David Wengier 5cb9daf917 Merge remote-tracking branch 'upstream/main' into CohostSigHelp 2024-07-17 14:51:19 +10:00
David Wengier d184cae5e6 Initial test commit but not working because I need to merge main 2024-07-17 14:50:38 +10:00
David Wengier 850778b7f1
Cohosting folding range tests (#10638)
Part of https://github.com/dotnet/razor/issues/9519 and
https://github.com/dotnet/razor/issues/10603

This time I did copy the existing tests, because everything was inline
so it was easier.
2024-07-17 14:50:17 +10:00
David Wengier 0884b799fb Fix test 2024-07-17 14:20:35 +10:00
David Wengier 9489e41cdb Update Version.Details.xml 2024-07-17 13:40:25 +10:00
David Wengier 12b6d0e088 Missed another spot 2024-07-17 13:37:21 +10:00
David Wengier fa94d4c535
Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2496558 (#10637)
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-07-17 12:26:29 +10:00
David Wengier bdf5796fd3 Bump Roslyn 2024-07-17 12:23:47 +10:00
David Wengier c80b84acc5 Updates after merge 2024-07-17 12:22:11 +10:00
David Wengier 57c32ad5c5 Merge remote-tracking branch 'upstream/main' into CohostSigHelp
# Conflicts:
#	eng/targets/Services.props
2024-07-17 12:15:37 +10:00
David Wengier bd398ca355 Remove dispose method 2024-07-17 12:09:49 +10:00
David Wengier 96b3fa310a Fix after insertion 2024-07-17 12:08:36 +10:00
David Wengier e1b7bc982a Bump Roslyn 2024-07-17 12:02:43 +10:00
David Wengier 43f12e8425 Apply suggestions from code review 2024-07-17 12:01:23 +10:00
David Wengier 19f2329629 Respond to CLaSP changes 2024-07-17 12:01:23 +10:00
David Wengier 98c64945f0 Use the test solution store to actual map solution infos to solutions 2024-07-17 12:01:19 +10:00
David Wengier 2b28abc906 Remove statics 2024-07-17 11:59:32 +10:00
David Wengier 78859c75f2 Fix bad assumption in tests 2024-07-17 11:59:32 +10:00
David Wengier e2549ad1e6 Add some html coverage 2024-07-17 11:55:56 +10:00
David Wengier d636a6f66e Rename base class 2024-07-17 11:30:42 +10:00
David Wengier 096f1fbfc8 Create cohosting folding range tests 2024-07-17 11:30:05 +10:00
dotnet bot 93440cc65c Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2496558 2024-07-16 18:26:40 -07:00
David Wengier c3031175cb
Cohosting semantic tokens tests (#10619)
Part of https://github.com/dotnet/razor/issues/9519 and
https://github.com/dotnet/razor/issues/10603

This was fairly straight forward too, though adding MVC files to the mix
found a bug in our test data, which is kind of humorous.

I decided not to copy all of the semantic tokens tests we have, but
rather just create something reasonably all-encompassing. The core
engine is shared so both sets of tests exercise it anyway.
2024-07-17 11:23:42 +10:00
Andrew Hall 0ded205cd4
Move StreamExtensions to netcore only (#10634) 2024-07-16 18:06:54 -07:00
Dustin Campbell b8f14d39bf Fix issue with cancelling AsyncBatchingWorkQueue
This was simply a mistake on my part. We should not assume that code is unreachable when it is reached because an OperationCanceledException is caught.
2024-07-16 17:42:16 -07:00
Dustin Campbell 6d76c6d52f Add "/" as special case when normalizing directories 2024-07-16 17:14:19 -07:00
Dustin Campbell 59aa56d396 Don't read past end of span in NormalizeAndDedupeSlashes 2024-07-16 17:11:34 -07:00
Dustin Campbell 214d921112 Ensure that we log exceptions during tests 2024-07-16 15:53:42 -07:00
Dustin Campbell 3138fb0be6 Do not swallow test logging errors that occur outside of tests 2024-07-16 15:53:42 -07:00
Dustin Campbell d96c004800 Fix BackgroundDocumentGeneratorTest that was throwing exception
The ProcessWorkAndRestart test was throwing an exception and swallowing it because a document was added to a project when the document's file path was outside of the project's.
2024-07-16 15:53:41 -07:00
Dustin Campbell 2edc20169d Move CreateTextLoader helper to TestMocks class 2024-07-16 15:53:41 -07:00
Dustin Campbell e67fab8002 Add missing `ReturnAsync` for mock 2024-07-16 15:53:40 -07:00
David Wengier 55fee1ecb7 Post merge updates, and rejig of client initialization options 2024-07-17 07:42:52 +10:00
David Wengier b2dae75517 Merge remote-tracking branch 'upstream/main' into dev/dawengie/CohostSemanticTokensTests
# Conflicts:
#	src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Initialization/RemoteClientInitializationService.cs
#	src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Initialization/RemoteClientInitializationServiceFactory.cs
#	src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostTestBase.cs
2024-07-17 07:34:22 +10:00
Dustin Campbell a182da61ec
Simplify co-hosting infrastructure and improve co-hosting test infrastructure (#10622)
This change represents refactoring of the existing co-hosting
infrastructure and some effort to make it a bit easier to test.
2024-07-16 12:56:07 -07:00
Dustin Campbell 323e74cae6 Prefer mock for IServiceBroker 2024-07-16 12:03:36 -07:00
Dustin Campbell 00a11a3ff7 Don't inherit EmptyLoggerFactory from AbstractLoggerFactory 2024-07-16 11:41:04 -07:00
Dustin Campbell 94a614ec51 Clean up RemoteMefComposition a bit 2024-07-16 11:36:02 -07:00
Dustin Campbell 12e4fbc92e
Fix Visual Studio unit tests (#10626)
It turns out that an old bug and some recent changes were causing
`MS.VS.LanguageService.Razor.Test` unit tests to fail intermittently.

1. I made a mistake when porting `AsyncBatchingWorkQueue` from Roslyn
that would cause an exception to be thrown if an
`OperationCanceledException` was thrown during batch processing.
2. `RazorActivityLog` would switch to the main thread when processing a
batch of messages. However, this is unnecessary, since `IVsActivityLog`
is supposed to a be a thread-safe VS service.
3. `RazorActivityLog` didn't check its cancellation token while
processing a batch of messages. This is problematic because it would
continue logging messages after `RazorActivityLog` was disposed.
4. The `IAsyncServiceProvider` mock passed to `RazorActivityLog` didn't
implement `IAsyncServiceProvider3`, which is super important. If that
interface isn't implemented, Visual Studio's `GetServiceAsync<TService,
TInterface>()` extension method will end up calling
`ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync()`, which will
fail in tests.

Together, these issues could cause the test process or AppDomain to
crash when the `LspEditorFeatureDetectorTest` tests were run. Since
these unit tests run in parallel, the end result would be strange
exceptions in other tests due to the test environment being torn down.
2024-07-16 10:52:55 -07:00