Skip to content
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 button "copy import statement to clipboard" #438

Open
flip111 opened this issue Jul 22, 2021 · 7 comments
Open

Add button "copy import statement to clipboard" #438

flip111 opened this issue Jul 22, 2021 · 7 comments

Comments

@flip111
Copy link

flip111 commented Jul 22, 2021

Would be nice to have a small button next to functions (and other things) to format an import statement and copy it to the clipboard

@flip111
Copy link
Author

flip111 commented Jan 22, 2023

Could be added here in the code

$of DeclarationResult _ moduleName _ _

@JordanMartinez
Copy link
Contributor

I kind of find it hard to justify this because I feel like this is a very rare use case. Put differently, is this just going to clutter up the UI if we add a button like this?

@flip111
Copy link
Author

flip111 commented Jan 31, 2023

Screenshot from 2023-01-31 23-08-04

Something like this, but better designed button. Probably could go on the module page too (screenshot is from search). Button could also be placed top-right similar to where Source is located next to functions in module docs.

I think the use case of looking up docs and then typing module name and function name into your code is very frequent. Now i usually scroll to top of page, copy the module name. And then i do this import <CTRL + V> (<function name i remembered>).

@JordanMartinez how does your workflow look like?

@JordanMartinez
Copy link
Contributor

🤦 I literally thought this issue was on the Try PureScript repo...

Ok. The copy import button does make sense.

@JordanMartinez
Copy link
Contributor

What are your thoughts on making the proposed button also copy it as a qualified import that the user defines? So,

  1. user interacts with the button (e.g. Ctrl+Click to trigger this behavior)
  2. an input appears and is focused
  3. user types in some alias (e.g. "Functor") and types Enter
  4. the following is copied to your clipboard:
import Data.Functor as Functor

@flip111
Copy link
Author

flip111 commented Feb 5, 2023

Seems like a good idea to me :)

I'm thinking whether it would pay off to have a toggle (i.e. checkbox) to enable/disable the popup somewhere (toggle state stored on the browser)

@JordanMartinez
Copy link
Contributor

🤷‍♂️ I don't know, but I would focus on getting your original idea in first. Otherwise, it may never get implemented due to focusing too much on my suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants