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

Clojure / general lisp support #183

Open
hoclun-rigsep opened this issue Mar 10, 2022 · 9 comments
Open

Clojure / general lisp support #183

hoclun-rigsep opened this issue Mar 10, 2022 · 9 comments

Comments

@hoclun-rigsep
Copy link

Any plans for supporting Clojure and/or lisps generally?

@AndrewRadev
Copy link
Owner

I would be happy to support lisp-like filetypes, but I don't have practical experience with them, so I don't know what kinds of splits and joins would make sense, what settings to provide, etc. If you use a lisp yourself, do you have any specific transformations you do often that the plugin could support? Maybe a few before/after examples of code snippets?

@hoclun-rigsep
Copy link
Author

Absolutely. My only experience is as a novice Clojure/ClojureScript
user. Source consists of "forms" which are delimited by () [] and
{}. Even a function call is just a (fn arg1 arg2) which means the
syntax is extremely general.

Simple examples, this calls the function +:

(+ 2 3 4 5)
(+
  2
  3
  4
  5)

guns/vim-sexp provides indentation.

From my project, this is properly indented and the brackets appear where they should:

(dispatch [::events/insert-staff-entry
            day-ord
            shift
            unit
            @why
            @who])

Would be nice to go to this, and back:

(dispatch [::events/insert-staff-entry day-ord shift unit @why @who])

If you need more discussion/research, I will help.

@AndrewRadev
Copy link
Owner

I've added some basic support to the main branch -- could you pull and try it out? If it works well for some of your real code, I'll write up some documentation, and if there's edge cases I haven't considered, I'll see what I can do to work them out.

@hoclun-rigsep
Copy link
Author

Thanks, very cool. I'll play with it at work next week and collect my experience.

@hoclun-rigsep
Copy link
Author

Still working on my report, thanks again

@hoclun-rigsep
Copy link
Author

Want to thank you for this, I had to move away from using Clojure at work for a while but I still intend to report back here.

@hoclun-rigsep
Copy link
Author

This is already useful as is—thank you.

Here's an issue:

(map (fn [[d s u i]] ^{:key i}
       [:tr
        [:td
         [row d s u i]
         "DOG"]])
     staff-keys)

If I position the cursor on :td (the form here is a "vector', vector literals [look like this]) and press gJ here is what I would expect: the :td form on one line, trailing delimiters from enclosing forms also on that line.

(map (fn [[d s u i]] ^{:key i}
       [:tr
        [:td [row d s u i] "DOG"]])
     staff-keys)

What I get is:

(map (fn [[d s u i]] ^{:key i}
  [:tr
   [:td [row d s u i] "DOG"]])           staff-keys)

@AndrewRadev
Copy link
Owner

It's funny, I was just fixing a very similar bug for a separate problem 😅. So at least I know what the issue is -- it should be fixed now.

@hoclun-rigsep
Copy link
Author

It does look fixed. I'll let you know what else I come across this week as I'm back at my Clojure/Script projects.

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