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

Incompatibility with tree-sitter #31

Open
NoahTheDuke opened this issue Jul 22, 2022 · 5 comments
Open

Incompatibility with tree-sitter #31

NoahTheDuke opened this issue Jul 22, 2022 · 5 comments

Comments

@NoahTheDuke
Copy link

Hey there! Love the plugin, it makes working in Clojure a breeze.

I've run into a small problem where if I use nvim-treesitter and leave additional_vim_regex_highlighting = false (meaning all syntax highlighting is provided by TS), then the " insert maps don't work correctly anymore, as s:syntax_match can't find any highlighting under the cursor.

Would it be feasible to add some awareness of TS and use that when appropriate?

I know than a solution is to set additional_vim_regex_highlighting = true, but it's not ideal because the two highlights clash and don't look great together.

@Grazfather
Copy link

+1 on this. A note for others finding this, you can also set additional_vim_regex_highlighting to a list of languages e.g. additional_vim_regex_highlighting = {"clojure" "racket" "fennel" "janet"}, although I agree it would be much nicer if this were not necessary.

@nbardiuk
Copy link

nbardiuk commented Sep 8, 2022

Another workaround is to disable the insert mapping using let g:sexp_enable_insert_mode_mappings = 0 and to use another plugin like nvim-autopairs.

@walterl
Copy link

walterl commented Dec 3, 2022

My workaround:

highlight = {
  enable = true,
  disable = { 'clojure' },
},

Using jiangmiao/auto-pairs, without setting additional_vim_regex_highlighting.

Disabling highlighting suits me fine, since TS-based highlighting doesn't highlight keywords for some reason.

Another way I test for this issue, is to add a string like (def "foobar"), move the cursor to the position between "foo" and "bar", insert ( (autopairs adds closing )), press enter (with the cursor between the parens), and end up with this:

(def "foo(

          )bar")

@walterl
Copy link

walterl commented Dec 3, 2022

Another consequence of the broken string handling: The paren inside the string in (def s "a)b") gets pair matched to the opening (. This has all kinds of detrimental effects on editing, like d% at the start of that form leaving you with b"), and the def's closing paren being interpreted as the closing paren for def's parent form.

@sheluchin
Copy link

See nvim-treesitter/nvim-treesitter#2966 for some additional context.

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

5 participants