steelbrain / intentions

Base package for showing intentions in Atom
MIT License
54 stars 11 forks source link

Using intentions as the code actions package? #84

Open aminya opened 3 years ago

aminya commented 3 years ago

I was thinking about using this package for our code actions. But the way decorations are handled causes issues such as #72.

What I want to suggest is to:

I am still confused about our solution for code actions, but it seems that the intentions package fits the problem better. 🤔

The alternative could be merging the code of the Intentions into Linter and retire Intentions. This would be the service API and how the actions are managed. Then we can use Linter-UI tooltips instead of the UI that intentions use. I prefer that we do not clutter the editor with code action decorations, so we need to adjust the UI of Linter-UI for this task.

Related: https://github.com/steelbrain/linter/issues/1705

aminya commented 3 years ago

Would like to hear your ideas. @steelbrain @uzitech @lierdakil

UziTech commented 3 years ago

I like the light bulb idea. Also holding Ctrl, or some defined keys, to underline like hyper click would work too.

steelbrain commented 3 years ago

Although it wasn't the best execution, I envisioned intentions to be the code actions package, while linter was one of the consumers that suggested the actions. There are a lot of code actions, some more proactively available than others:

But thinking about it now, this could be solved with a light-bulb style API. The user would see the highlight coming from linter and when they select that range, they could see the lightbulb coming from intentions. Thank you for working on this!

jeff-hykin commented 3 years ago

All I ask is that the lightbulb icon be a rectangle with rounded corners and a proper shadow.

As opposed to something like this; an icon that is the shape of the bulb 💡 and looks like an emoji character inside the code Screenshot_20210615-080043__01.jpg

jeff-hykin commented 3 years ago

Overall, I think it would be fine to show all of the light bulbs so long as they weren't visually obtrusive like other editors.

For example, a tiny gray outline of a bulb off in the gutter on the left side of the editor wouldn't be visual noise. If you were looking for it it would be there, but it wouldn't draw your attention away from the code. So from a cognitive load perspective, it would be fine to have 15 of those in one view.

Then just save the lit-up lightbulb for the current line, and have it dim to 50% opacity after 3 sec of inactivity.

k2d222 commented 3 years ago

Instead of adding a lightbulb, wouldn't it be possible to reuse the "dots" from the linter-ui ? It would avoid having another gutter taking space on the side. For code actions on warning / errors the dots could be clickable, and for other actions, we could show a dot only for the current line.

jeff-hykin commented 3 years ago

Instead of adding a lightbulb, wouldn't it be possible to reuse the "dots" from the linter-ui ? It would avoid having another gutter taking space on the side. For code actions on warning / errors the dots could be clickable, and for other actions, we could show a dot only for the current line.

I support this.

Googling "IntelliJ Lightbulb" almost half the results are "how to disable IntelliJ lightbulb". And if people want to disable a useful feature, that probably means they screwed up the UI/UX. Keeping the UI as minimal as possible will probably avoid that problem.

aminya commented 3 years ago

I don't think adding another gutter makes sense. I would prefer a lightbulb UI because it would produce much less visual distraction.

Instead of adding a lightbulb, wouldn't it be possible to reuse the "dots" from the linter-ui ? It would avoid having another gutter taking space on the side. For code actions on warning / errors the dots could be clickable, and for other actions, we could show a dot only for the current line.

Googling "IntelliJ Lightbulb" almost half the results are "how to disable IntelliJ lightbulb". And if people want to disable a useful feature, that probably means they screwed up the UI/UX. Keeping the UI as minimal as possible will probably avoid that problem.

The placement of the lightbulb is important here. I also don't think that putting the icon "on the code" is a good idea (what Intellij does). It should be in the gutter like Linter, but we shouldn't show all of the available code actions at once (that would mean that almost all the lines would have a lightbulb!).

My plan for now: