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

Automatic interface/mli generation should use virtual files / temporary buffers #982

Open
ELLIOTTCABLE opened this issue Jul 5, 2022 · 3 comments

Comments

@ELLIOTTCABLE
Copy link

At the moment, if I need to quickly check whether a given file I'm looking at has any docs, the go-to seems to be O. This, sometimes-helpfully, generates an interface if none exists.

However, about half the time, that means one has to deal with this dialog:

Screen Shot 2022-07-05 at 2 37 15 PM

Generally speaking, I'd say that this should default to not saving the file. (My logic being this: you either slightly-annoy people trying to check-the-file-if-it-exists, to save some annoyance on behalf of someone who is trying to use VScode to generate the initial intf-file for a module that doesn't yet have one; or vice versa: annoy file-creators a little more ("wait! why didn't that save?"), at the cost of annoying file-readers a little less. I'd suppose that the former activity, reading, is much, much more common than the latter activity, creating.)

Would it be possible for the extension to, if the .mli doesn't already exist, use a virtual document for this? Or, in some other way, prevent the above blocking modal from appearing on created MLIs?

@ulugbekna
Copy link
Collaborator

I'd say that this should default to not saving the file

I don't think we can configure that, if you intended to propose a change there.

I just do cmd + delete to pick "don't save" (that's the default keybinding on mac to pick "cancel" out of two options)

I agree that the workflow could be improved though.

@rgrinberg
Copy link
Contributor

if I need to quickly check whether a given file I'm looking at has any docs, the go-to seems to be ⌥O. This, sometimes-helpfully, generates an interface if none exists.

Why do we do this anyway? If the .mli doesn't exist I don't think we should automatically insert anything.

@ulugbekna
Copy link
Collaborator

We do that because the code action to insert the interface is not very discoverable for the user, IIRC. I don’t like this insertion too much either. I think we could distinguish switch with insertion to another keybiding shift+option+o (vs current option+o which would just do the switch)

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

3 participants