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

8106 Коммитов

Автор SHA1 Сообщение Дата
dotnet-maestro[bot] d6806e2a9a
Update dependencies from https://github.com/dotnet/arcade build 20220729.10 (#6673)
[main] Update dependencies from dotnet/arcade
2022-08-01 13:10:54 +00:00
Sandy Armstrong a0186c4f48
Mac: Add Addin dependency on TextEditor (#6663)
* Mac: Add Addin dependency on TextEditor

* Update addin.info
2022-07-30 08:44:54 -07:00
N. Taylor Mullen cc12662112
Fix C# ambiguity errors in old Razor editor in VSMac. (#6669)
* Fix C# ambiguity errors in old Razor editor in VSMac.

- Fixed by updating virtual C# to be *.ide.cs instead of *.g.cs
- Turns out Razor in VSMac overloads the .g.cs file suffix for projection buffers which then results in our "background C# file generation" thinking files are actually open when they're not. SO to elaborate, when you open a .razor file in the old editor in VSMac you get 3 files:
    1. The .razor file you opened
    2. A .razor.g.cs file that represents the generated C# in the projection buffer
    3. Another .razor.g.cs file that represents the "closed file" representation of that document. Once opened we empty out our background document to avoid name collisions.
When I fixed how we populate C# LSP documents into the C# workspace I changed the VSMac number 3 above from ".g.cs" => ".razor.g.cs" because that's how the LSP system looks up documents too; however, this introduced a conflict with the projection buffer representation of the old editor. That conflict was a problem because when we went to try and "empty" our closed file representation the VSMac side would do a [lookup](bcf3d00848/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/DynamicFileManager.cs (L95-L98)) to see if the file was open, and if it was ignore the "empty" behavior. Therefore both the projection and the closed file representation would exist simultaneously causing ambiguity errors

- TO fix the above I went ahead and normalized where we create C#/HTML virtual file paths evvvvverywhere. Ultimately these file paths now come from ourr language server feature options which was already a MEF service. In addition I went from .g.cs to .ide.cs to avoid conflicts with the projection buffer.
- Updated tests across the board to account for this new behavior.

Fixes #6630 and https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1582970

* Fix build.

* Fix build part 2

* ide.cs => ide.g.cs

* Fix tests.
2022-07-30 07:08:15 +00:00
Allison Chou 936b493d3b
Update FabricBot for 17.1 P2 (#6666) 2022-07-29 10:54:43 -07:00
David Wengier b9b472e0f8
Merge pull request #6662 from davidwengier/MoreVisualizerFix 2022-07-29 05:18:41 +10:00
David Wengier ed638378d6 Use the same colour for treeview item selection, whether focused or not 2022-07-28 11:19:42 +10:00
N. Taylor Mullen 01c1bf7f37
Add TextMate information to VSMac Addin. (#6649)
* Add TextMate information to VSMac Addin.

- Update TextMate information for VSMac.
- Added new MSBuild goop to copy VSWin's TextMate pieces into VSMac's addin.
    - As part of this I had to update our mpack generator to respect a sub-folder indicator.

* Add aspnetcorerazor.tmLanguage.json to Addin
2022-07-27 16:00:10 -07:00
N. Taylor Mullen 24c6e5d766
Extend timeout to 2 hours for Windows builds. (#6648) 2022-07-26 20:43:30 -07:00
David Wengier b10895cddd
Merge pull request #6640 from davidwengier/SyntaxVisualizerFixes 2022-07-27 06:40:56 +10:00
N. Taylor Mullen cdbf19152a
Revert "Remove duplicate assemblies from extension install. (#6508)" (#6644)
This reverts commit 47badc17ac.
2022-07-26 19:49:57 +00:00
David Wengier e6926d298f Better colour contrast 2022-07-26 14:16:16 +10:00
David Wengier 1198f3dee9 Switch focus to editor when pressing Enter (fixes AB#1580007) 2022-07-26 14:16:15 +10:00
David Wengier a195e265b9 Fix keyboard cycling (fixes AB#1579500) 2022-07-26 13:10:38 +10:00
David Wengier d828125e69 Don't expand on select (fixes AB#1579508) 2022-07-26 08:31:32 +10:00
N. Taylor Mullen c92673ca49
Address PoliCheck issues :D (#6639)
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1576608
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1579252
2022-07-25 22:30:59 +00:00
David Wengier 06d3328ecc Use case insensitivity for file paths 2022-07-26 08:30:40 +10:00
N. Taylor Mullen d61e927442
Fix project.razor.json generation on Mac. (#6638)
* Fix project.razor.json generation on Mac.

- Turns out project system interactions on mac still use windows style paths. Meaning, if we query MSBuild for information like the `obj` directory we'll get the path back with `\`. These paths then explode when passed to normal .NET APIs. This fix translates all MSBuild / local file system interactions to utilize `/` on Macs.
- Unfortunately due to the MonoDevelop APIs these sections can't be properly tested without extensive re-work. This was already the precedent so #yolo

* Address code review comments.
2022-07-25 22:16:07 +00:00
N. Taylor Mullen a73028a0bb Unskip SetBreakpoint_FirstCharacter_InvalidLine.
- 17.3-P1 has shipped and is widely available.

Fixes #6280
2022-07-25 14:26:06 -07:00
Andrew Hall 2da9ac4c5a
Fix Extract To Code Behind Produces "__GeneratedComponent" Namespace (#6633)
In extract to code behind, there are cases where the setup is not fully ready for the compiler to accurately generate a namespace. Luckily they provide a public extension point to get the namespace for a document, which handles fallback behavior and failure. Use that in the action provider to determine if a namespace is accurately available. If it is, fill the action params with that namespace and use for generating the code rather than recalculating it again.

Fixes #4441
2022-07-25 14:24:11 -07:00
dotnet-maestro[bot] 896b172e35
Update dependencies from https://github.com/dotnet/arcade build 20220722.1 (#6635)
[main] Update dependencies from dotnet/arcade
2022-07-25 17:32:40 +00:00
N. Taylor Mullen eafe5352f1 Add support for acquiring formatting options from client. (#6627)
- This is the final part to #6618 to enable completion resolve to acquire formatting options for complex text edits so it can properly format text edits
- We now expose a new endpoint on the client under `razor/formatting/options` that will return the most recent understanding of formatting options
- To make this possible updated the `FormattingOptionsProvider` API to take a `Uri` instead of a document snapshot.
- Updated tests accordingly

Final part of #6618
2022-07-25 09:24:03 -07:00
N. Taylor Mullen f93689a470 Add support for remapping TextEdits & AdditionalTextEdits at resolve time. (#6626)
* Add support for remapping TextEdits & AdditionalTextEdits at resolve time.

- Migrated our old `CompletionResolutionHandler` logic for post-processing C# completion items to our new single server completion system.
    - One current gap is that the old system used to lookup active formatting options on the client to understand if snippets should be formatted with/without tabs etc. For now I'm using defaults but in a follow up PR i'll light up the real formatting options acquisition logic.
- As part of this PR there were several pieces of code that could be re-used so I refactored them out. The `TestRazorFormattingService` is a prime example (especially now that completion resolve depends on it).
    - Did a few updates to the API so it was clear what type of formatting service you'd be getting (aka should it be HTML enabled?).
- Added a test that validates that we get and remap text edit completions properly (I use `await`). I couldn't find a corresponding C# completion item that utilizes `AdditionalTextEdit`s.

## Enables

![gif of await and override completion working](https://i.imgur.com/EAwqM3j.gif)

Most of #6618

* Address code review comments.
2022-07-25 09:24:03 -07:00
N. Taylor Mullen 0f8ac098be Fix `FormatSnippetAsync` to properly format C# snippets.
- Prior to this C# snippets were wrapped/unwrapped at the endpoint layer. This means anyone trying to format a snippet would need to manually wrap/unwrap their own snippets. The logic fit well into the existing formatting service so I migrated the logic there.
- Another aspect of this that's a little disconnected is that when applying formatted snippet edits I found that edits wouldn't get "minimialized" prior to collapsing which would result in unminified edits returning to the client. At completion time (what I will eventually be doing as part of #6618) this was highly troublesome because completion is sensitive to the "end of the edit" area. Meaning if you complete `await` and the await has a complex text edit that gets formatted the `t` in `await` needs to be the absolute last thing in the edit to not obstruct the cursor; however, without the minimal edit change that doesn't actually work properly. I imagine this was just an unintentional oversight and wasn't quite sure how to test this (although I do test it in the completion resolve tests that are coming latere) so I included it here.
- Currently there's no direct tests of this method it looks like. Although in a follow up PR for #6618 I'll be formatting resolved completion items.

Part of #6618
2022-07-25 09:24:03 -07:00
N. Taylor Mullen aaa444009a
Fix Razor's C# doc population into the workspace. (#6629)
- Not sure why we originally were changing the file extension of our generated documents to not include the Razor file extension. This aligns LSP's understanding of file paths with the dynamic file info understanding. Given how much tribal knowledge / convention is baked into the `.g.cs` ending we should probably build a factory; however, getting that factory to work across all products (VS, VSCode, VSMac) is less than simple. For now here's the quick fix.
2022-07-22 22:24:20 +00:00
N. Taylor Mullen 5eb0a04e40
Unskip completion list provider test. (#6628)
- The original `CSharp_Operator_Triggered` test was an incorrect scenario. For instance, C# doesn't typically trigger completions off of typing `(`. Instead I migrated the test to do a `DateTime.` variant with `.` being the trigger. The only catch then was that our generated C# document did not contain `using System` so I had to update our generated code document bits to properly generate the using statement.

Part of #6618
2022-07-22 14:57:22 -07:00
N. Taylor Mullen 2a62139b89
Migrate delegated completion list resolver tests to use C# server. (#6624)
- Updated C# portions of our delegated completion list provider tests to utilze the real C# server and simplified the testing model.
- Maintained a lot of pre-existing tests because we don't have similar capabilities for HTML
- These tests will be more widely used upon completion of #6618 where we'll want to resolve text edits (this is a leadup).

Part of #6618
2022-07-22 20:47:15 +00:00
N. Taylor Mullen 405fbee98f
Migrate completion list provider tests to utilize C# server where applicable. (#6621)
- Found that for trigger character based tests completion results weren't being returned. Meaning, invoking completion at `@if (|)` wouldn't result in any completions. I tried this with a few different samples and all didn't work.
- Updated the delegated completion list provider to take in a CSharp server.
- Shamelessly stole 90% of this from @allisonchou
2022-07-22 13:02:45 -07:00
N. Taylor Mullen 2c1e0e082f
Allow TagHelper completions to show up when typing space. (#6615)
- Expanded trigger characters to include a space for TagHelper completion
- Missed this originally when enabling single server completion!

Fixes #6601
2022-07-19 17:30:00 -07:00
David Wengier 4b5def0649
Merge pull request #6603 from davidwengier/FixMinimizedAttributeCompletions 2022-07-20 08:03:46 +10:00
N. Taylor Mullen c162845d4c
Fix VSMac file paths for LSP editor. (#6613)
- Mac & windows boxes represent file paths differently `/` versus `\`. Sadly at the portion where our system intersects with project systems (CPS or VSMac's custom) file paths need to fall back to a platform equivalent so that files can properly be looked up. This changeset adds a platform check in order to special case this scenario. Didn't feel great about this path but I don't have a better way without making external-to-razor project system specific changes on both VSWin and VSMac.
2022-07-19 14:54:48 -07:00
N. Taylor Mullen 19e9f320d1
Cache generated output as long as CodeDocument is referenced. (#6609)
- This changeset changes how our `DocumentSnapshot` system caches its output. Previous it relied on a secondary system to dig deep into a `DocumentSnapshot`, extract its "generate output task" and then hold onto a reference of that. In this change I expand `DocumentState` to be "code document reference aware"; meaning, if someone is referencing the generated output then the output is maintained so we don't need to re-parse / compute data. Ultimately this ends up bringing our new system back into par with our existing perf and even surpassing it in quick typing scenarios (multiple document states flowing simultaneously).
- With this changeset and some rudimentary testing I saw a 10% reduction in overall cache misses compared to what exists today while also maintaining simplicity.
- Added tests to validate we do the right thing at referene / cache time.

Final part of #6043
2022-07-19 14:54:34 -07:00
N. Taylor Mullen 3448e1d9a8
Remediating Azure Artifacts Configuration Issues. (#6612)
* Remediating Azure Artifacts Configuration Issues.

- Porting from [this PR that was done on the wrong repo](https://dev.azure.com/dnceng/internal/_git/dotnet-razor-tooling/pullrequest/23705?_a=files). I tried to maintain branch / naming etc. but wasn't able to maintain author info. Seems like Azdo threw away the details maybe?

* Address code review comments.
2022-07-19 14:47:05 -07:00
David Wengier e4878c99c6 Expand to more attribute types, and update tests 2022-07-19 10:20:44 +10:00
dotnet-maestro[bot] 704bf1a315 Update dependencies from https://github.com/dotnet/razor-compiler build 20220714.1
Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal , Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Internal.Transport , Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X.Internal.Transport , Microsoft.AspNetCore.Razor.Symbols.Transport , Microsoft.CodeAnalysis.Razor.Tooling.Internal
 From Version 7.0.0-preview.5.22357.2 -> To Version 7.0.0-preview.5.22364.1
2022-07-18 17:02:59 -07:00
N. Taylor Mullen b3d525a53b Remove C# and Html output versioning.
- On its surface having a C#/HTML output version seems appealing; however, in practice we've never used it because the `SourceText` that stores the output already versions this information. Also, when digging through the code I found that every time we'd parse a file we'd aggressively be generating the C#/HTML docs (even when we don't need it) and simultaneously we'd also be doing massive string equals checks to try and understand versioning. This changeset removes all of that.
- Updated tests to remove the C#/HTML output checks because they no longer exist
- Made `DocumentState` nullable enabled.

Done as part of #6043 although it technically could stand on its own.
2022-07-18 15:34:10 -07:00
David Wengier c91ae9851d
Add package source mapping for internal tools (#6608) 2022-07-18 22:11:38 +00:00
N. Taylor Mullen 5d8c3448ea Replace GeneratedDocumentContainer & its dependencies. (#6602)
* Replace GeneratedDocumentContainer & deps.

- This changeset effectively removes all `GeneratedDocumentContainer` assets. Let me explain what effectively this means. Prior to this whenever a Document was parsed there was a decoupled system that attempted to understand the "latest document" and capture its generated output in one of these generated containers. That decoupled system was also responsibel for publishing generated C#/HTML to the client. Meaning, whenever it saw a change to its generated C# container or HTML container it'd push a notification to the client to update C#/HTML buffers. The issue with the old system is that it was so decoupled from the rest of the tooling system that things like "open/closing" files couldn't be understood meaning we couldn't reset document content when closing an unsaved document. For another in-depth understanding of this see [this](https://github.com/dotnet/razor-tooling/issues/6043#issuecomment-1185969172).
    - The new system presents itself as a service (the `GeneratedDocumentSynchronizer`) and as documents change via project updates, document additions or document changes this synchronizer is notified via the `DocumentProccessedListener` infra. Upon notification it can then re-dispatch those "processed" updates to a C#/HTML publisher. This new path enables us to be open/close document aware (document changes) so that upon closing/open we can re-push C#/HTML to the client effectively fixing this issue (#6043).
- One huge benefit of moving this way is the sheer amount of code we can delete. Was able to remove our generated document containers, the factory for them, the store for them, their tests, and all their old fragile consumption bits.
- A piece that's missing from this PR is that we used to capture references to generated C# computations via the `ReferenceOutputCapturingContainer` which is now removed. It had to be removed because it can no longer hook into these generated document stores (they don't exist). I plan to replace this in follow up PRs. As a point-in-time measurement the perf may still be better due to how much less work we need to do; however, we do cache miss more so that's debatable. In my follow ups we are actually able to significantly exceed pre-existing perf measurements.
- Had to update our O# plugin handling of document processed listeners upon removal of the generated containers.
- Added new tests and updated pre-existing ones.

Mostly fixes #6043 with the exception of the slight cache miss regression (coming soon)

* Address code review comments.

- Removes even more code!
2022-07-18 13:45:31 -07:00
N. Taylor Mullen b713004344 Expand `DocumentProcessedListener` to pass processed output.
- This expands the `DocumentProcessedListener` infra to pass the "processed" document output. The reason why this is important is because once we process a document there's no guarantee that the output wont get GC'd. Therefore, we capture the output that we already processed and pass it through to anyone who cares. In the end this will help sub-systems who want to reduce how frequently they accidentally re-parse documents that are actively being introspected.
- I decided not to expand our diagnostic publisher to use the processed output becaues we have separate plans to move the diagnostic publishing system to "pull" which will result in the entire publisher getting reworked.
- Updated all call sites and tests.

Part of #6043
2022-07-18 13:45:31 -07:00
N. Taylor Mullen c01f4365f1 Remove unneeded document processed listener code.
- Way way back in the day I wrote `UnsynchronizableContentDocumentProcessedListener` as a way to "fix up" generated C#/HTML when things went out of wack. For a long while I ran local bits with a breakpoint in the "do something" portion of the code AND even ran with the code deleted and breakpoint never hit + things never broke. Therefore, this is dead code and given I plan to repurpose the document processed listener infra going to nuke this code to reduce noise.
- Also removed test and service registration

Part of #6043
2022-07-18 13:45:31 -07:00
N. Taylor Mullen e814857943 Migrate OpenDocumentGenerator to BatchingWorkQueue.
- This is preliminary work for changing how we update generated C#/HTML content on the client. The end-goal is to utilize the open document generator's `DocumentProcessedListener` infrastructure to provide a "Generated synchronizer" that listens to processed documents and pushes those processed document updates down to the client.
    - I also plan to remove the `ReferenceCaptureOutputContainer` tech which utilizes a batching work queue to control how often we set generated output given we'll be changing how generated output is propagated.
- Changed the OpenDocumentGenerator tests to utilize the non-legacy dispatcher + fully test the new infrastructure.

Part of #6043
2022-07-18 13:45:31 -07:00
dotnet-maestro[bot] f5cba71691
Update dependencies from https://github.com/dotnet/arcade build 20220717.1 (#6605)
[main] Update dependencies from dotnet/arcade
2022-07-18 13:19:42 +00:00
David Wengier 5fd2f16086 Allow minimized attribute completions anywhere in the attribute 2022-07-18 10:53:32 +10:00
David Wengier 365f8f7d96
Only return minimal text edits if we get back a tilde from the Html LSP server (#6597)
* Only return minimal text edits if we get back a tilde from the Html language server

* PR feedback (and some sneaky cleanup)
2022-07-16 05:38:51 +00:00
N. Taylor Mullen e29b964a2e
Fix formatting tests that test markup after directive body. (#6594)
- Originally found in this Integration test CI failure: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=6414782&view=results
- This ended up revealing a few issues:
    1. Prior to this changeset formatting tests would wait for folding ranges to be available before attempting to format anything. In the above CI failure those checks timed out and the screenshots included also showed that no folding ranges were available. This indicates there might be a secondary issue where folding ranges ar ea little flakey. I've filed [this](https://github.com/dotnet/razor-tooling/issues/6592) to track re-enabling code folding tests and moved our existing formatting tests off of folding ranges being available to waiting for semantic classifications
    2. With the introduction of [this](https://github.com/dotnet/razor-tooling/pull/6531) change we started accurately formatting content after directive bodies. Updated our baselines for formatting tests to capture this new requirement.
- As part of this work I also found that the existing `WaitForClassificationAsync` was a little misleading because it defaulted to waiting for Razor component classifications. I've gone ahead and renamed the existing method to `WaitForComponentClassificationAsync` to be extra clear what's being waited for. As an extra reaction I added a general `WaitForSemanticClassificationAsync` that's now used in Razor formatting tests so we can wait for semantic Razor transitions.
2022-07-14 13:59:16 -07:00
N. Taylor Mullen 2a16ad4a94
Fix Debug.Assert when delegated completions aren't C# or HTML. (#6591)
- When typing out directives like `@functions` the cursor would sit at the end of the identifier which would resolve the language as "Razor" resulting in a `Debug.Assert` failure in our middle layer [here](6cc43d8203/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/DefaultRazorLanguageServerCustomMessageTarget.cs (L1024)). This ensures we actively no-op when we're in non-C#/HTML scenarios at completion time.
- Added a test  to validate

Fixes #6590
2022-07-14 09:28:38 -07:00
N. Taylor Mullen 8b2f6015f7
Set default value for single sever completion to "true" (#6589)
- We're flighting "true" to all internal users in 17.3 builds; however, for 17.4 we're going to be on-by-default so we have an entire release to catch and address issues. If this ends up being a problem we can remotely  turn it off OR we can physically swap the switch.

Fixes #6421
2022-07-14 16:14:54 +00:00
David Wengier 7567f3dd7c
Merge pull request #6587 from davidwengier/NugetSourceMapping 2022-07-14 14:22:45 +10:00
David Wengier d6188a88ab
Don't spin up 2 threads for every text edit (#6577)
* Use a batching work queue to prevent repeated work

At the very least this cuts the amount of work in half, as we hook up two events to this one method, so every text change would call this twice. Now the work queue ignores the first one for us.

Secondly, the timeout is very short, but still long enough that fast typing will not cause repeated work until there is a slight pause.

* Remove unused properties

Previously we reduced how often we would do a bunch of work, but it turns out a lot of that work wasn't ever used anyway. Seems to me like its better to just not do the work in the first place.

* Decrease timeout

* Remove debug code

* Doc
2022-07-14 01:50:28 +00:00
David Wengier 6cc43d8203
Merge pull request #6531 from tuespetre/issue-4358 2022-07-14 08:43:42 +10:00
DoctorKrolic cb4799647f
Fixed explicit completions invocation for tag helper attributes (#6580)
* Fixed explicit completions invocation for tag helper attributes

* Fix for tag helpers

* Fixed potential tag helper case
2022-07-13 11:13:14 -07:00