-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for context links to dart fix
#51987
Comments
I like that idea. The more context we can provide, whether the fix is automated or not, the better for the user. We might also be able to display that information with the diagnostic so that it's also visible for users that don't run |
@DanTup , could you take a look at the above screenshots? Is this something we can surface in VS Code? Can we show links to urls as part of a CodeAction/Command? |
@jwren, can we display documentation links along with the quick fix in IntelliJ/Android Studio? Does the API allow for this type of information to be sent and displayed? |
We have an API for such notifications to be displayed in IJ, I have started but not finished, wiring up the required JSON. |
We can't add nested actions to items in the code actions menu like that, we can only supply a flat list (the groupings of fixes/refactors/etc. are hard-coded in VS Code based on the code action I also don't think we can include markdown links in diagnostics (microsoft/vscode#54272). We can attach a URL to a diagnostic, but it's attached to the error code (that's the part that becomes clickable) and there's only one. A question about the links though... If they are about the deprecation rather than the automated fix (the initial comment says some things won't have automated fixes?), might it be better to have them on the |
That would be better than nothing, but the problem with putting information on the annotation (and one of the major reasons why we have data files) is that when the deprecated API is removed the information about how to fix it disappears along with it. Being able to put the URL in the data file has some advantages if we can figure out how to allow the user to follow the link. |
There are plenty of reasons that a fix isn't supported by
dart fix
:dart fix
doesn't support a fix yetIn these cases, and possibly as an addition to automatible cases, it'd be nice to be able to provide a context link that could drive users to a migration doc.
Proposal
Add a new
context
field to thetransform
object. This field will accept a list ofcontextLink
objects consisting of atitle
anduri
. The titles of the links would be displayed in the context menu. They would show as an external link (with the appropriate icon and semantics) and clicking on them would open the link in a browser.When fixes are applied through the terminal, either nothing would happen, or fixes with context would have the location of the error and the
contextLink
printed tostdout
.To support fixes that we can only provide context for, the requirements of
transform
would expand to allow:changes
oneOf
context
changes
andcontext
, oroneOf
andcontext
Examples
Adding context to an automated fix
Context Menu
Adding context to a un-automated fix
Context Menu
The text was updated successfully, but these errors were encountered: