Fork me on GitHub
#vim
<
2022-05-28
>
Dumch11:05:17

Hey. Who uses treesitter, do you have a problem that braces inside strings take effect on parsing? https://github.com/nvim-treesitter/nvim-treesitter/issues/2966

Olical13:05:46

Yep! I get this in fennel and clojure a lot, it's really annoying 😞

Olical13:05:08

TS is better in every way except this, it's almost a total deal breaker. I have to disable TS for some buffers because of it.

sheluchin14:05:32

I think it's related to the issue I reported a few weeks ago: https://clojurians.slack.com/archives/C0DF8R51A/p1652287464353689 It looks like the TS highlight has a few bugs when dealing with Clojure. The TS highlight module also breaks string handling in vim-sexp. I think this old https://clojurians.slack.com/archives/C0DF8R51A/p1638774405114700 was reporting the same thing. Basically, the operator-pending string mappings defined in vim-sexp (`as`, is) stop working completely after :TSEnable highlight and :TSDisable highlight fixes it all.

🙏 1
sheluchin13:05:26

Can confirm the fix suggested in https://github.com/nvim-treesitter/nvim-treesitter/issues/2966#issuecomment-1140408607 does work on all the related problems. Other nvim-treesitter issues suggest using a TS-aware matching plugin like https://github.com/andymass/vim-matchup, but that alone doesn't fix this issue. Thanks for raising this @UL05W6AEM. Not sure, but maybe setting additional_vim_regex_highlighting = "clojure" should be suggested in plugins that rely on it, like vim-sexp.

Leaf Garland23:05:03

I've been using this plugin for a little while - it seems to work ok.

Dumch10:05:03

If I get it correct, it will support % and delete-matching-pair. But indents wont work and sexp vaf will not work either

Leaf Garland11:05:21

True. vim-sexp is using the old syntax highlighting to know what text is strings or comments - so it won't work correctly with treesitter.

sheluchin11:05:46

I think this is what I was picking up on what I thought a while back that treesitter conflicts with LSP: https://clojurians.slack.com/archives/C0DF8R51A/p1647395546702489?thread_ts=1647377862.618059&amp;cid=C0DF8R51A So it's not LSP that's the issue, it's the very popular vim-sexp that doesn't work correctly with treesitter. And vim-sexp is used by vim-iced, so the conflicts run deep there. It's quite difficult to understand all this. I'm starting to make sense of it now, but I can see how this would be frustrating for someone new to Clojure and trying to configure their Vim as their editing environment. Perhaps I'll open an issue in vim-sexp to highlight the potential issues with treesitter. Is there anything else we could do to improve/clarify the situation for people trying to set up/modify their Vim for Clojure?

👍 1
Dumch11:05:11

If only there is a decent alternative to vim-sexp. May be it could be built in inside Conjure? Then Counjure would become the only needed plugin for neovim (with lsp and treesitter).

sheluchin12:05:29

I don't totally understand the differences between them - haven't really tried Conjure at length - but I love vim-iced. I would hope some improvement to the landscape could be leveraged by whatever development environment people prefer. Both vim-iced and Conjure are actively maintained, and I'm not sure how vim-fireplace fits into the picture, if it does, or if there are yet more alternatives.

Dumch12:05:53

I used to be iced-user. Compare to it conjure seems to be much faster (one reason is that vim-iced is written with vimscript, and conjure with lua). One more advantage of conjure is that is supports fennel, so one can write vim-config with almost the same workflow as with clojure.

sheluchin18:06:26

@UL05W6AEM do you know if you can also use fennel to extend Conjure?

Dumch18:06:00

What do you mean by extend? Write your configs in fennel and use some conjure mappings? Or do you ask weather Conjure itself is written in fennel? https://github.com/Olical/conjure/tree/master/fnl/conjure