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 a hole to contruct in if one doesn't exist? #23

Closed
shonfeder opened this issue Jan 18, 2025 · 1 comment
Closed

Add a hole to contruct in if one doesn't exist? #23

shonfeder opened this issue Jan 18, 2025 · 1 comment

Comments

@shonfeder
Copy link

Hello! Congrats and many thanks for this very nice work. As I go about integrating it into my config, I'm finding the functionality super clean and helpful.

Currently, if the cursor is located at | in an expression like:

let x : bool list = |

And i call ocaml-eglot-construct, it reports eglot--error: [eglot] Not a hole. However, it seems like it would be nice in this kind of situation to make a hole and try to construct in it. I think this kind of context aware, DWIM behavior would be consistent with other parts of the interface, such as, inferring whether to find definitions in the same or different files.

In my config, I have been able to get the behavior I want with

(defun my/ocaml-eglot-construct ()
  "Construct a term, making a hole first if needed"
  (interactive)
  (if (equal (symbol-at-point) '_)
      (ocaml-eglot-construct)
    (progn (save-excursion (insert "_"))
           (ocaml-eglot-construct))))

Would it make sense to make this the default behavior of ocaml-eglot-construct? If not, perhaps this is useful enough to add as a helper function?

xvw added a commit that referenced this issue Jan 20, 2025
@xvw
Copy link
Member

xvw commented Jan 23, 2025

Closed because of #24

@xvw xvw closed this as completed Jan 23, 2025
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