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

15768 Коммитов

Автор SHA1 Сообщение Дата
Dustin Campbell e2abf82a99 Pass CancellationToken to GetGeneratedOutputAsync
This commit is ginormous because I needed to thread cancellation tokens around everywhere.
2024-10-10 17:21:48 -07:00
Dustin Campbell 85d588c537 Switch IDocumentSnapshot.GetGenerateOutputAsync to ValueTask 2024-10-10 17:21:48 -07:00
Dustin Campbell 6dcfda5b73 Switch GetCSharpSyntaxTreeAsync to ValueTask and cache its result 2024-10-10 17:21:48 -07:00
Dustin Campbell b537b48872 Fix up some unit tests 2024-10-10 17:21:47 -07:00
Dustin Campbell 5adac610b5 Pass a CancellationToken to GetTextAsync and GetTextVersionAsync 2024-10-10 17:21:47 -07:00
Dustin Campbell 0cca69b3b6 Switch IDocumentSnapshot.GetTextAsync to ValueTask 2024-10-10 17:21:47 -07:00
Dustin Campbell 0fe0b44954 Switch IDocumentSnapshot.GetTextVersionAsync to ValueTask 2024-10-10 17:21:46 -07:00
Dustin Campbell 6c4bfda1bc Use TextLoader and TextAndVersion in DocumentState 2024-10-10 17:21:46 -07:00
Dustin Campbell dca70b6f8d
Clean up DocumentSnapshot and ProjectSnapshot (#10995)
This is some code I had locally and decided it would be good to check
in. There should be no observable change. This essentially removes some
unneeded bits, hides internal state, tights assumptions, simplifies
code, and cleans up test infrastructure. The commit history should be
explanatory.
2024-10-10 17:20:04 -07:00
Fred Silberberg 4c78255fb7
Unpin Roslyn Versions (#10994)
* Unpin Roslyn Versions

Now that we have the analyzer work done in VS, we should be able to unpin the versions of the roslyn compiler that we depend on in razor.

* Remove VersionOverrides
2024-10-10 14:45:20 -07:00
Dustin Campbell 078ea0fc21 Apply code review feedback to ImportDocumentSnapshot 2024-10-10 12:43:42 -07:00
Jan Jones fe4c0a911a
Recognize `_Imports.razor` in the source generator (#10992) 2024-10-10 10:31:36 +02:00
David Wengier 33f1199a64
Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2556868 (#10993) 2024-10-10 12:54:08 +11:00
Chris Sienkiewicz 81d92962aa
Fix @inherits mapping for fuse (#10985)
* Make base type a token rather than a string
* Track inherits source location and emit it when present
* Add simple inherits test for components
* Add razor page inherits test
2024-10-09 16:50:17 -07:00
Dustin Campbell 8d6dda7efd Clean up ProjectSnapshot a bit 2024-10-09 16:39:12 -07:00
Dustin Campbell 296a63f99f Clean up DocumentSnapshot a bit 2024-10-09 16:39:12 -07:00
Dustin Campbell a2f990e2ff Clean up ImportDocumentSnapshot 2024-10-09 16:39:12 -07:00
Dustin Campbell d1d3d48ced Don't expose DocumentSnapshot.State 2024-10-09 16:39:12 -07:00
Dustin Campbell ca3f42bcfa Remove IDocumentSnapshot.SupportsOutput
Nothing actually calls this property.
2024-10-09 16:39:11 -07:00
Dustin Campbell 635d9b90fa Seal DocumentSnapshot and ProjectSnapshot
DocumentSnapshot and ProjectSnapshot had several virtual methods intended to be overridden in test infrastructure. This change removes the override behavior in tests and seals the classes.
2024-10-09 16:39:11 -07:00
Dustin Campbell a9a09a41d6 Don't use TestProjectSnapshot in HoverServiceTest 2024-10-09 16:39:09 -07:00
Dustin Campbell 71981dcede Remove CreateAndAddProject/Document test extension methods 2024-10-09 16:39:09 -07:00
Dustin Campbell b6f047f3f7 Don't expose ProjectSnapshot.State 2024-10-09 16:39:09 -07:00
Dustin Campbell 16ee599618 Convert HostProject to a record 2024-10-09 16:39:07 -07:00
Dustin Campbell 74641d049e Convert HostDocument to a record 2024-10-09 16:39:06 -07:00
dotnet bot a93533df95 Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2556780 2024-10-09 15:09:14 -07:00
David Wengier 6f378ca07d
RazorProjectService cleanup (#10989)
Noticed while working on my previous PR. There were a few methods in
RazorProjectService that were only used by tests, and also resulted in
some tests validating things that could never happen in the product
(like passing `null` for a project file path in an update). This PR
removes one unused method, moves one to a test accessor where it rightly
should be, and updates the tests that were calling `UpdateProjectAsync`
to instead call through `IRazorProjectServiceListener.UpdatedAsync`.

I don't love that these tests have to call through that interface, but I
didn't change the method to be implicitly implemented because I don't
think the name makes sense when written that way.

There are, or at least should be, no functionality changes in this PR.
2024-10-10 08:49:40 +11:00
Ankita Khera ccd20341a9
Update PublishData.json (#10986)
Updates publishdata after snap
2024-10-08 17:37:37 -07:00
David Wengier 365b5cc782 Fix up the final AddProject tests
Mostly these didn't test real scenarios, and one needed changing to test the UpdatedAsync method properly
2024-10-09 11:23:59 +11:00
David Wengier a42e09cf2f Rename tests 2024-10-09 11:23:59 +11:00
David Wengier 15dd1dffc0 Remove tests that validate impossible user scenarios 2024-10-09 11:23:59 +11:00
David Wengier 5ead4f87ed Use interface method instead of test accessor 2024-10-09 11:23:59 +11:00
David Wengier f1937db471 Move unused methods to test accessor
Purely mechanical changes
2024-10-09 11:23:59 +11:00
David Wengier 0e4d1f9b37
Fix project publish (or: Various project system fixes) (#10983)
Fixes https://github.com/dotnet/razor/issues/10970

Each commit in this PR essentially hardens the project system a little
bit more. Together they fix the publish issue, which is a particularly
difficult scenario, as it essentially removes and quickly re-adds a
project, but I think the changes are pretty good overall. No one commit
fixes the publish issue, and I wouldn't say there is no more work to do,
but forward progress is forward progress.

Each commit is isolated to a particular service and has a brief
description of what the change is and why, but I think it's perfectly
understood when looked at as a whole too. Review however you prefer :)
2024-10-09 11:12:26 +11:00
Ankita Khera c860252114
Update PublishData.json 2024-10-08 17:09:04 -07:00
David Wengier c7d6c913ab PR feedback 2024-10-09 10:47:01 +11:00
Chris Sienkiewicz 7f81d931d2
Emit and map empty csharp tokens (#10969)
* Emit and map empty csharp tokens
- Add test and update baselines
* Unskip test
2024-10-08 11:26:23 -07:00
Dustin Campbell ef8467d7c2
Move TagHelperTooltipFactories to the Workspaces layer (#10980)
This change decouples the two TagHelperTooltipFactories from the Razor
language server and moves them to the Workspaces layer for use in
co-hosting. Ultimately, co-hosting will be able to do a better job
producing hover and completion item tooltips, but that can come later.
2024-10-08 11:11:03 -07:00
Dustin Campbell 29055def22 Update doc comment 2024-10-08 10:39:07 -07:00
dotnet bot 82f7008a89
Merge release/dev17.12 to main (#10982)
This is an automatically generated pull request from release/dev17.12
into main.


Once all conflicts are resolved and all the tests pass, you are free to
merge the pull request. 🐯

## Troubleshooting conflicts

### Identify authors of changes which introduced merge conflicts
Scroll to the bottom, then for each file containing conflicts copy its
path into the following searches:
- https://github.com/dotnet/razor/find/release/dev17.12
- https://github.com/dotnet/razor/find/main

Usually the most recent change to a file between the two branches is
considered to have introduced the conflicts, but sometimes it will be
necessary to look for the conflicting lines and check the blame in each
branch. Generally the author whose change introduced the conflicts
should pull down this PR, fix the conflicts locally, then push up a
commit resolving the conflicts.

### Resolve merge conflicts using your local repo
Sometimes merge conflicts may be present on GitHub but merging locally
will work without conflicts. This is due to differences between the
merge algorithm used in local git versus the one used by GitHub.
``` bash
git fetch --all
git checkout -t upstream/merges/release/dev17.12-to-main
git reset --hard upstream/main
git merge upstream/release/dev17.12
# Fix merge conflicts
git commit
git push upstream merges/release/dev17.12-to-main --force
```
2024-10-07 23:43:07 -07:00
David Wengier c9f1768c80 Don't publish documents that have been subsequently removed from the project
When all documents are removed from a project, if the imports file comes first, it will cause a recompile of all open razor files, even though they will themselves later on be removed.
This didn't used to cause any issues during publish, because the generated document would
be sent over, and later clobbered with a subsequent change. Now that documents are self-versioned, that subsequent change could be for a version number less than the removed document, and hence be thrown away. Plus it's wasted work.
2024-10-08 17:40:35 +11:00
David Wengier 0be4b139de Remove previous publish data when documents are removed
Now that snapshots are self-versioned, if we don't keep our "previously published data" clean we'll end up re-publishing versions of documents that are new on the client side, but not new on the server.
2024-10-08 17:40:35 +11:00
David Wengier 0ad17e1b97 Stop trying to guess which projects documents belong to
When publishing, we see a project remove for obj/Debug, and move all files to the misc
project, then we'd see a new project for obj/Release, and add that. That add would then
cause us to go through all of the misc files, and add them to the first project that could
possibly have them - in this case, adding them right back to obj/Debug.

Generally speaking we shouldn't be guessing at anything with project info, but rather rely
on correct input from systems. ie, if they add a project, they presumably will then follow
up with telling us which documents are in it.
2024-10-08 17:40:35 +11:00
David Wengier 934e638072 Batch virtual document refreshes together
The things receiving project events on the server side were all batching their work together, so quick
remove-then-add sequences for documents would be merged together on the server side. Not doing that on
the client side too just made it much harder for things to ever be in sync.
2024-10-08 17:40:34 +11:00
David Wengier 73d760159d Fix open document comparer
This was previously using the hash code of the document snapshot, therefore publishing every request. This meant
we got publishes for old documents when they were superseded by newer ones.
2024-10-08 16:37:38 +11:00
David Wengier a7648d0ddc
Fix Generate Event Handler code action (#10967)
Cherry pick of the commit from
https://github.com/dotnet/razor/pull/10959 that fixes code actions in
FUSE, **and fixing the generate event handler code action which is
unrelated to FUSE**, in case we decide we want to take it for 17.12 P3

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2268945
2024-10-08 16:34:49 +11:00
Dustin Campbell 0b98610035 Move TagHelperTooltipFactories to Workspaces layer 2024-10-07 17:37:10 -07:00
Dustin Campbell b7bb1e06ee Convert ClassifiedTagHelperTooltipFactory to a static class 2024-10-07 17:37:10 -07:00
Dustin Campbell 67d2f15e77 Convert MarkupTagHelperTooltipFactory to a static class 2024-10-07 17:37:05 -07:00
Dustin Campbell cde46524f1 Split out ProjectAvailabilityTests 2024-10-07 17:36:10 -07:00