Olical / dotfiles

Configuration for Linux, i3, Kitty, Fish, Neovim and more
https://oli.me.uk
The Unlicense
508 stars 45 forks source link

Fennel development assistance #8

Closed sharefantasy closed 3 years ago

sharefantasy commented 3 years ago

Hi, Olical, I'm a big fan of your idea of making fennel as the only configuration language in neovim. I try to adapt your configuration to my daily use but some how stuck in some basic problems developing in fennel.

  1. How to make "jump to definition" and "jump to reference" actions?
  2. Is there a format tool for fennel ?
  3. Is there a "preview compilation" command ?

I assume that both fennel syntax support and the actions above are implemented in Aniseed, but I haven't found it yet. Could you help me please? Thanks !

Olical commented 3 years ago

Hey there! I'll try my best to answer although I'm worried I won't be very helpful 😓

  1. I only really rely on search across my project with fzf and * / # to search in buffer. I don't have any jump to reference, if there's a Fennel language server (which I doubt?) we could use the Neovim LSP client for that functionality. I would love to add support for this but that information doesn't exist, there's no metadata on functions that lets me check where they were defined 😭
  2. It looks like this PR from someone in the Conjure discord will help with formatting! https://github.com/jose-elias-alvarez/null-ls.nvim/pull/79/ I need to start using this too 😄 I don't use it yet, I just have https://github.com/guns/vim-sexp installed and press =- or == on forms to indent them, I perform all formatting by hand in Clojure and Fennel right now.
  3. By preview complication I guess you mean looking at the Lua output from the compiler 🤔 there is no command for this yet, but that could be a good one if you wanted to open an issue on Conjure? Alternatively you could require the aniseed.compile module and run your source code through that to compile it to Lua and return the resulting string within Neovim itself: https://github.com/Olical/aniseed/blob/c15c4e49d6ecb7ad7252902bb1b4310ba161617a/fnl/aniseed/compile.fnl

I know this doesn't fully answer your questions, but I hope it's a helpful start! A mapping to compile a form under the cursor and print the resulting Lua in the log buffer would be a pretty cool addition to Conjure 😄

sharefantasy commented 3 years ago

Thank you for the answers. I get several ideas to developing this actions. I found this emacs plugin for fennel fennel-mode, maybe I can mimic its implementation. And now I'm trying to use null-ls first.