mickeynp / combobulate

Structured Editing and Navigation in Emacs with Tree-Sitter
GNU General Public License v3.0
909 stars 53 forks source link

combobulate-splice-up triggers (wrong-type-argument integerp #<marker ...>) #112

Open DamienCassou opened 3 days ago

DamienCassou commented 3 days ago
  1. Execute

    emacs -Q \
      --eval "(setq treesit-extra-load-path '(\"/...path-to-grammars/\"))" \
      --eval "(add-to-list 'load-path \"~/.emacs.d/lib/combobulate\")" \
      --eval "(require 'combobulate)" \
      --eval "(setq initial-scratch-message \"console.log(\\\"test\\\")\")" \
      --eval "(js-ts-mode)" \
      --eval "(combobulate-mode)"

    You get a buffer containing:

    console.log("test")
  2. Type M-b and C-b to move point between the ( and the "
  3. Type M-<up>

Expected: The string "test" to replace the console.log() call

Actual: (wrong-type-argument integerp #<marker ...>)

Debugger entered--Lisp error: (wrong-type-argument integerp #<marker at 12 in *scratch*>)
  signal(wrong-type-argument (integerp #<marker at 12 in *scratch*>))
  combobulate-proffer-choices((#<treesit-node-outdated> #<treesit-node-outdated> #<treesit-node-outdated>) #f(compiled-function (action) #<bytecode 0xeda6e9c5c0cfd1b>) :prompt-description "Splice out" :quiet t)
  combobulate-splice(#<treesit-node-outdated> (self after around))
  combobulate-splice-up(1)

Actual: transient-setup: Assertion failed: (and prefix (symbolp prefix))

mickeynp commented 2 days ago

Hm. I cannot reproduce this. I even wrote a test case matching yours.

If the last error is the one you actually see (the assertion failed error) , then I've fixed it already and this issue is just a casualty of the other one.

DamienCassou commented 1 day ago

I can still reproduce using the latest commit in master. I'm using Emacs 30.0.91.

In the *Messages* buffer, I also see:

Error during redisplay: (jit-lock-function 1) signaled (treesit-query-error "Structure error at" 52 "((arrow_function body:
         ((_ (sequence_expression left: (_) @combobulate-query-highlight-vibrant-veggie-face)))))" "Debug the query with `treesit-query-validate'")
mickeynp commented 1 day ago

That's a different error altogether. Are you using the proper grammar versions as per the readme?

DamienCassou commented 1 day ago

I thought I wrote it in the issue's description but I didn't, sorry: I'm using the latest commit from master. This is what my GNU/Linux distribution provides.

Are you interested in such issues? If not, feel free to close the ticket.

mickeynp commented 1 day ago

Yes, but the version of tree-sitter and the grammars are very important. There's a table of grammar versions you must use. Does it happen if you use those?

DamienCassou commented 7 hours ago

I can't manage to be 100% sure but I think I switched back to grammar 0.20.1 and I can still reproduce the issue. If you know a way to ask for the grammar's version, I would happily use that.

I even wrote a test case matching yours.

All 649 unit tests pass, regardless of the version of javascript's grammar. Do you have a clue why?