Comments (8)
@AlexanderEgurtsovDX What changes are you trying to make in PostProcessChangesAsync? Thanks!
from roslyn.
@AlexanderEgurtsovDX What changes are you trying to make in PostProcessChangesAsync? Thanks!
@CyrusNajmabadi,
We are usually processing every changed document - getting annotated nodes and perform necessary processing, like adding necessary visibility modifiers, namespace references.
from roslyn.
Can you do that in the fixer itself instead of a post processing pass?
from roslyn.
Our entire logic is built on assumption that some operations are done in the post processing pass.
For example, every refactoring that adds type qualifier, also adds annotation to simplify this type(or add it's namespace part as namespace reference). There are at least 30+ such refactorings, so adding such logic inside them is not a good idea.
We can try to recreate the removed logic in our code - get all changed or added documents and post process them on our side. However, there are few disadvantages in this approach:
- there can be unexpected side effects
- we need to distinguish where to apply such logic(for example, VS 2019 and VS 2022 17.10 are working well) for some versions and that can also cause bugs
from roslyn.
The challenge here is that the prior approach was not scalable. every change would run N steps of 'cleanup', which of course would would then fork individual documents, which would then do things like causing generators to run.
THe new approach is non-extensible, and works by applying a single phase of cleanup to all changed documents at once, getting a new fork, then the entire next phase of cleanup to that fork, and so on.
This allowed cost of something like fix-all to drop from around 30 minutes on large solutions to a couple of minutes. While it was nice to allow arbitrary cleanup on a doc level, it just didn't scale, and effectively made it non-viable to do this sort of work.
--
We can try to recreate the removed logic in our code - get all changed or added documents and post process them on our side. However, there are few disadvantages in this approach:
My recommendation would be to keep the individual fixes the same. But have your compute operations function then do the final pass on them. Similarly, create your own FixAllProvider that produces an operation that does the cleanup on the entire operation as a postpass like you do today. Basically, allow the invidiaul fixes to stay the same, but wrap in a common piece of code that has the semantics you want.
from roslyn.
That's a significant breaking change and it's surprising to see it without any notifications, like deprecating the PostProcessChangesAsync
first.
From my point of view, mentioned cleanup changes should be done in a separate method(new one), while still allowing the third-party extensions to apply it's own logic if required.
from roslyn.
Will work on getting a notification/deprecation announcement.
From my point of view, mentioned cleanup changes should be done in a separate method(new one), while still allowing the third-party extensions to apply it's own logic if required.
The issue here is that cleanup being document-based simply isn't tenable. It cannot scale, especially in a world with generators. Preferred route if custom cleanup does need to be done is to do something similar to what we did, and do all the work at once across documents. That way the cleanup can be done in parallel, and so that instead of number of forks scaling with the number of passes times the number of documents, it can scale simply with the number of passes.
from roslyn.
That is not the answer I was hoping for, but it's expected.
Thank you for sharing your thoughts on the issue and for your time!
from roslyn.
Related Issues (20)
- Error in 【MSBuildWorkspace.Create() .OpenSolutionAsync()】:System.Exception (cannotfound BuildHost) HOT 1
- ISymbol.ToMinimalDisplayString() ignores the SymbolDisplayTypeQualificationStyle.NameOnly formatting option. HOT 2
- [Bug] IDE0058 not work
- Task List filtering for current project doesn't work as expected
- switch expression: Warning CS8524 issued although all cases have been covered HOT 5
- Add assembly version information to method tooltips
- Automatic class initialization scaffolding
- Add string to NameOf option in intellisense
- Add IL Viewer for .NET languages HOT 1
- Make fields generated in a primary constructor able to be readonly HOT 1
- Can't see primary constructor variables in debugger
- Run a single generator at a time HOT 1
- Prepend $(NoWarn) to list analyzer rule generates a false positive. HOT 1
- Add compiler warning about CS file name not matching the class/interface contained within
- [Automated] PRs inserted in VS build feature.debugger.main-35020.110
- [Automated] PRs inserted in VS build main-35020.20
- Code Lens doesn't show references on Source Generated files
- Error/Warning messages on network share are not navigable HOT 1
- Cycle in required members
- Microsoft.DotNet.GenAPI.Tests/CSharpFileBuilderTests.cs in SDK repo test failures
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roslyn.