Live re-application and diff view updates of aspects on save
It's awfully convenient to enable Continuous Testing in Visual Studio. I turn it on and every time I save a file, Visual Studio kicks in to re-run any unit tests that apply to that particular bit of code and if I've got the test tooling panel open, I can see in near real-time whether I've broken anything.
Today, when I start making changes to as aspect, that little golden bar shows up at the top of Visual Studio indicating that I'm making changes to the aspect and when I'm finished, I can click the "I'm done" button. The aspect will be re-applied everywhere applicable and after a brief pause (indicated by the processing of background tasks icon in the bottom left of Visual Studio) I can right click any of the targets it's applied to, select the "Show Metalama Diff" option from the context menu and voila, there's the target with the applied aspect. If I already have a diff open, I have to close it and re-open it from a target.
All well and good for now, but I'd like to propose that this workflow be updated to reflect something more akin to the Continuous Testing functionality. I'd love to instead shift the workflow to the following:
- Make changes to an aspect. Visual Studio detects that I've made changes and marks the tab with the asterisk showing unsaved changes. No golden warnings show up.
- When I save the aspect, it automatically applies it behind the scenes to all applicable targets
- If I have any Metalama Diff windows open, they maybe show a little icon in a corner indicating they're getting updated, but then automatically refresh to show the updates as applied (and any such open tabs are prioritized as the first targets of any aspect updates with other updates happening in the background, assuming they run in some sort of consecutive order).
Ideally then, I'd be able to then start up VS, open up the diff of one of the targets, open the aspect and start typing as I would during run-time code development. When I'm done, I hit Ctrl + S and after a brief delay, my diff window updates to reflect the changes. Especially by having multiple diffs open that each have a different aspect order applied and being able to see them all refresh in turn with updates automatically, this would save me an awful lot of 1) time to view the changes, memory from open target tabs (so I might re-open the diffs today between changes) and 3) generally make the whole workflow feel a lot smoother and more alike any other background processing task (again, like Continuous Testing).
Thank you for the consideration!
8 Replies
Thank you for sharing.
This behavior (that you need to explicitly build or click on I am done) , at the moment, is intentional. We have code that pauses the pipeline when aspects are being edited. Compiling aspects is quite expensive. Compiled aspects are loaded into memory and never GCed. So it's not a good idea to refresh them in real time.
I can see how the experience of creating aspects could be smoother, but it would come at a high cost and currently we need to try to pick lower-hanging fruits.
That's entirely fair - while I fully expect this to be a longer term feature, I still wanted to put the request out there to make clear that there's at least one customer interested in it.
I'd like to understand the use case better however. Is it when developing aspects, to get quicker feedback?
Yes. Going back to the idea of the unit testing bit, I'm able to see a panel that clearly indicates whether a change I make to either the test or application code impacts the other and rather immediately. I don't need to take my hands off the keyboard and click anything and it just happens in the background between saves.
I'd like to see the faster feedback not just in terms of developing the aspect itself, but also seeing how it's being applied to anything in the same solution: e.g. highlight conflicts with implementations such as an introduced method failed to override as indicated or where there were otherwise exceptions thrown while applying it. It also would mean that I can type without taking my hands off the keyboard to click a little (and increasingly smaller button as I keep upgrading my monitor resolution) button that moves around (as it's occasionally hidden in a wall of error messages)
In fact, better idea - I'd love to see it implemented much like the Hot Reload functionality as a toolbar button.
By default, I have to click the button to re-apply the aspect, but I can click that "Hot Reload on File Save" button if I want to opt in to have it re-applied every time I save the aspect file itself (or any files to which an aspect is applied).
Give me a tiny purple Llama button 😄
Knowing, of course, that I'd opt for the "Apply Aspect on File Save" and never actually click the button
@xaniff @domsinclair I have created a ticket on GitHub for future references since Discord conversations are not "persistent".
GitHub
Feature request: better aspect development experience · Issue #148 ...
This is a catch-all ticket to gather ideas related to improving the experience of developing aspects. Common grievances at this point are: It is not easy to know for which targets the aspect succee...