GithubHelp home page GithubHelp logo

Comments (8)

ubolonton avatar ubolonton commented on April 24, 2024

This seems to be one of the edge cases in Emacs's change tracking mechanism, where the to-be-changed range passed to before-change-functions is empty, but the before-change-text's length passed to after-change-functions is non-zero (106).

Can you provide more details to reproduce/debug it? For example:

  • The Python file.
  • The snippet being used (and maybe yasnippet's config).
  • Steps to trigger the behavior. For example, any navigation/editing after opening the file.

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

I ran a session of debugging with elisp bug hunter and this is the results:

You have asked to do an interactive hunt, here's how it goes.
1) I will start a new Emacs instance, which opens a new frame.
2) You will try to reproduce your problem on the new frame.
3) When you’re done, close that frame.
4) I will ask you if you managed to reproduce the problem.
5) We will repeat steps up to 11 times, so hang tight!
Doing some initial tests...
Initial tests done. Hunting for the cause...
"/Users/joaraya/.emacs", line 835 pos 0:
  The assertion returned the following value here:
    t
  Caused by the following expression:
    (use-package tree-sitter-langs :straight
      (tree-sitter-langs :host github :repo "ubolonton/emacs-tree-sitter" :files
                         ("langs/*.el" "langs/queries")))



confusing to say at least lol.

I cannot reproduce this bug on my GNU/Linux machine running Emacs 28 tho. I will try to reproduce with a minimal conf and see what happens

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

Cannot reproduce on my GNU/Linux machine with Emacs 26. Maybe this is isolated to macOS somehow

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

I just reproduced this bug on my GNU/Linux machine:

Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  insert(nil)
  (progn (insert old-text) (let* ((rel-pos (+ 1 rel-beg old-len)) (rel-byte (position-bytes rel-pos)) (x701 (car beg-point)) (x702 (cdr beg-point))) (let ((beg-byte-column x702) (beg-line-number x701)) (let* ((val (ts--point-from-position rel-pos)) (x699 (car val)) (x700 (cdr val))) (let ((rel-byte-column x700) (rel-line-number x699)) (let* ((old-end-line-number ...) (old-end-byte-column ...)) (setq old-end-byte (+ beg-byte rel-byte -1) old-end-point (cons old-end-line-number old-end-byte-column))))))))
  (unwind-protect (progn (insert old-text) (let* ((rel-pos (+ 1 rel-beg old-len)) (rel-byte (position-bytes rel-pos)) (x701 (car beg-point)) (x702 (cdr beg-point))) (let ((beg-byte-column x702) (beg-line-number x701)) (let* ((val (ts--point-from-position rel-pos)) (x699 (car val)) (x700 (cdr val))) (let ((rel-byte-column x700) (rel-line-number x699)) (let* (... ...) (setq old-end-byte ... old-end-point ...))))))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert old-text) (let* ((rel-pos (+ 1 rel-beg old-len)) (rel-byte (position-bytes rel-pos)) (x701 (car beg-point)) (x702 (cdr beg-point))) (let ((beg-byte-column x702) (beg-line-number x701)) (let* ((val ...) (x699 ...) (x700 ...)) (let (... ...) (let* ... ...)))))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert old-text) (let* ((rel-pos (+ 1 rel-beg old-len)) (rel-byte (position-bytes rel-pos)) (x701 (car beg-point)) (x702 (cdr beg-point))) (let ((beg-byte-column x702) (beg-line-number x701)) (let* (... ... ...) (let ... ...))))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (let ((old-text tree-sitter--text-before-change) (rel-beg (- beg tree-sitter--beg-before-change))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert old-text) (let* ((rel-pos ...) (rel-byte ...) (x701 ...) (x702 ...)) (let (... ...) (let* ... ...)))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))
  (if (= old-len 0) (setq old-end-byte beg-byte old-end-point beg-point) (let ((old-text tree-sitter--text-before-change) (rel-beg (- beg tree-sitter--beg-before-change))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert old-text) (let* (... ... ... ...) (let ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))))
  (let ((beg-byte (position-bytes beg)) (new-end-byte (position-bytes new-end)) old-end-byte beg-point old-end-point new-end-point) (save-excursion (save-restriction (widen) (setq beg-point (ts--point-from-position beg) new-end-point (ts--point-from-position new-end)))) (if (= old-len 0) (setq old-end-byte beg-byte old-end-point beg-point) (let ((old-text tree-sitter--text-before-change) (rel-beg (- beg tree-sitter--beg-before-change))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert old-text) (let* ... ...)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (ts-edit-tree tree-sitter-tree beg-byte old-end-byte new-end-byte beg-point old-end-point new-end-point) (tree-sitter--do-parse))
  (progn (let ((beg-byte (position-bytes beg)) (new-end-byte (position-bytes new-end)) old-end-byte beg-point old-end-point new-end-point) (save-excursion (save-restriction (widen) (setq beg-point (ts--point-from-position beg) new-end-point (ts--point-from-position new-end)))) (if (= old-len 0) (setq old-end-byte beg-byte old-end-point beg-point) (let ((old-text tree-sitter--text-before-change) (rel-beg (- beg tree-sitter--beg-before-change))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...)))))) (ts-edit-tree tree-sitter-tree beg-byte old-end-byte new-end-byte beg-point old-end-point new-end-point) (tree-sitter--do-parse)))
  (if tree-sitter-tree (progn (let ((beg-byte (position-bytes beg)) (new-end-byte (position-bytes new-end)) old-end-byte beg-point old-end-point new-end-point) (save-excursion (save-restriction (widen) (setq beg-point (ts--point-from-position beg) new-end-point (ts--point-from-position new-end)))) (if (= old-len 0) (setq old-end-byte beg-byte old-end-point beg-point) (let ((old-text tree-sitter--text-before-change) (rel-beg (- beg tree-sitter--beg-before-change))) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))))) (ts-edit-tree tree-sitter-tree beg-byte old-end-byte new-end-byte beg-point old-end-point new-end-point) (tree-sitter--do-parse))))
  tree-sitter--after-change(82 97 15)
  run-hook-with-args(tree-sitter--after-change 82 97 15)
  (let ((buffer-undo-list t)) (goto-char begin) (run-hook-with-args 'before-change-functions begin end) (let ((before-change-functions nil) (after-change-functions nil)) (insert content) (narrow-to-region begin (point)) (goto-char (point-min)) (yas--snippet-parse-create snippet)) (run-hook-with-args 'after-change-functions (point-min) (point-max) (- (point-max) (point-min))))
  (lambda nil (let ((buffer-undo-list t)) (goto-char begin) (run-hook-with-args 'before-change-functions begin end) (let ((before-change-functions nil) (after-change-functions nil)) (insert content) (narrow-to-region begin (point)) (goto-char (point-min)) (yas--snippet-parse-create snippet)) (run-hook-with-args 'after-change-functions (point-min) (point-max) (- (point-max) (point-min)))) (if (listp buffer-undo-list) (progn (setq buffer-undo-list (cons (cons (point-min) (point-max)) buffer-undo-list)))) (yas--indent snippet) (if (listp buffer-undo-list) (progn (setq buffer-undo-list (cons (list 'apply 'yas--take-care-of-redo snippet) buffer-undo-list)))) (yas--snippet-sort-fields snippet) (progn (or (and (memq (type-of snippet) cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list 'yas--snippet snippet))) (let* ((v snippet)) (aset v 5 (yas--make-control-overlay snippet (point-min) (point-max))))) (goto-char (point-max)) (setq yas--active-snippets (cons snippet yas--active-snippets)) snippet)()
  funcall((lambda nil (let ((buffer-undo-list t)) (goto-char begin) (run-hook-with-args 'before-change-functions begin end) (let ((before-change-functions nil) (after-change-functions nil)) (insert content) (narrow-to-region begin (point)) (goto-char (point-min)) (yas--snippet-parse-create snippet)) (run-hook-with-args 'after-change-functions (point-min) (point-max) (- (point-max) (point-min)))) (if (listp buffer-undo-list) (progn (setq buffer-undo-list (cons (cons (point-min) (point-max)) buffer-undo-list)))) (yas--indent snippet) (if (listp buffer-undo-list) (progn (setq buffer-undo-list (cons (list 'apply 'yas--take-care-of-redo snippet) buffer-undo-list)))) (yas--snippet-sort-fields snippet) (progn (or (and (memq (type-of snippet) cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list 'yas--snippet snippet))) (let* ((v snippet)) (aset v 5 (yas--make-control-overlay snippet (point-min) (point-max))))) (goto-char (point-max)) (setq yas--active-snippets (cons snippet yas--active-snippets)) snippet))
  (let nil (funcall '(lambda nil (let ((buffer-undo-list t)) (goto-char begin) (run-hook-with-args 'before-change-functions begin end) (let ((before-change-functions nil) (after-change-functions nil)) (insert content) (narrow-to-region begin (point)) (goto-char (point-min)) (yas--snippet-parse-create snippet)) (run-hook-with-args 'after-change-functions (point-min) (point-max) (- (point-max) (point-min)))) (if (listp buffer-undo-list) (progn (setq buffer-undo-list (cons ... buffer-undo-list)))) (yas--indent snippet) (if (listp buffer-undo-list) (progn (setq buffer-undo-list (cons ... buffer-undo-list)))) (yas--snippet-sort-fields snippet) (progn (or (and (memq ... cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list ... snippet))) (let* ((v snippet)) (aset v 5 (yas--make-control-overlay snippet ... ...)))) (goto-char (point-max)) (setq yas--active-snippets (cons snippet yas--active-snippets)) snippet)))
  eval((let nil (funcall '(lambda nil (let ((buffer-undo-list t)) (goto-char begin) (run-hook-with-args 'before-change-functions begin end) (let (... ...) (insert content) (narrow-to-region begin ...) (goto-char ...) (yas--snippet-parse-create snippet)) (run-hook-with-args 'after-change-functions (point-min) (point-max) (- ... ...))) (if (listp buffer-undo-list) (progn (setq buffer-undo-list ...))) (yas--indent snippet) (if (listp buffer-undo-list) (progn (setq buffer-undo-list ...))) (yas--snippet-sort-fields snippet) (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 5 ...))) (goto-char (point-max)) (setq yas--active-snippets (cons snippet yas--active-snippets)) snippet))))
  (let* ((syms (mapcar #'car envvar)) (vals (mapcar #'(lambda (v-f) (eval (car ...))) envvar)) (body #'(lambda nil (let ((buffer-undo-list t)) (goto-char begin) (run-hook-with-args 'before-change-functions begin end) (let (... ...) (insert content) (narrow-to-region begin ...) (goto-char ...) (yas--snippet-parse-create snippet)) (run-hook-with-args 'after-change-functions (point-min) (point-max) (- ... ...))) (if (listp buffer-undo-list) (progn (setq buffer-undo-list ...))) (yas--indent snippet) (if (listp buffer-undo-list) (progn (setq buffer-undo-list ...))) (yas--snippet-sort-fields snippet) (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 5 ...))) (goto-char (point-max)) (setq yas--active-snippets (cons snippet yas--active-snippets)) snippet)) (binds nil)) (while syms (setq binds (cons (list (car-safe (prog1 syms (setq syms ...))) (list 'quote (car-safe (prog1 vals ...)))) binds))) (eval (list 'let binds (list 'funcall (list 'quote body)))))
  (progn (let* ((syms (mapcar #'car envvar)) (vals (mapcar #'(lambda (v-f) (eval ...)) envvar)) (body #'(lambda nil (let (...) (goto-char begin) (run-hook-with-args ... begin end) (let ... ... ... ... ...) (run-hook-with-args ... ... ... ...)) (if (listp buffer-undo-list) (progn ...)) (yas--indent snippet) (if (listp buffer-undo-list) (progn ...)) (yas--snippet-sort-fields snippet) (progn (or ... ...) (let* ... ...)) (goto-char (point-max)) (setq yas--active-snippets (cons snippet yas--active-snippets)) snippet)) (binds nil)) (while syms (setq binds (cons (list (car-safe (prog1 syms ...)) (list 'quote (car-safe ...))) binds))) (eval (list 'let binds (list 'funcall (list 'quote body))))))
  (let ((envvar expand-env)) (progn (let* ((syms (mapcar #'car envvar)) (vals (mapcar #'(lambda ... ...) envvar)) (body #'(lambda nil (let ... ... ... ... ...) (if ... ...) (yas--indent snippet) (if ... ...) (yas--snippet-sort-fields snippet) (progn ... ...) (goto-char ...) (setq yas--active-snippets ...) snippet)) (binds nil)) (while syms (setq binds (cons (list (car-safe ...) (list ... ...)) binds))) (eval (list 'let binds (list 'funcall (list 'quote body)))))))
  (let ((snippet (record 'yas--snippet expand-env 'nil nil (yas--snippet-next-id) nil nil nil nil))) (let ((envvar expand-env)) (progn (let* ((syms (mapcar #'car envvar)) (vals (mapcar #'... envvar)) (body #'(lambda nil ... ... ... ... ... ... ... ... snippet)) (binds nil)) (while syms (setq binds (cons (list ... ...) binds))) (eval (list 'let binds (list 'funcall (list ... body))))))))
  (save-restriction (let ((snippet (record 'yas--snippet expand-env 'nil nil (yas--snippet-next-id) nil nil nil nil))) (let ((envvar expand-env)) (progn (let* ((syms (mapcar ... envvar)) (vals (mapcar ... envvar)) (body #'...) (binds nil)) (while syms (setq binds (cons ... binds))) (eval (list 'let binds (list ... ...))))))))
  yas--snippet-create(#("SuscripcionTipo" 0 15 (fontified nil)) nil 82 82)
  (setq snippet (yas--snippet-create content expand-env start (point)))
  (let ((yas--inhibit-overlay-hooks t)) (setq snippet (yas--snippet-create content expand-env start (point))))
  (cond ((listp content) (yas--eval-for-effect content)) (t (setq yas--start-column (current-column)) (let ((yas--inhibit-overlay-hooks t)) (setq snippet (yas--snippet-create content expand-env start (point)))) (let ((existing-field (and yas--active-field-overlay (overlay-buffer yas--active-field-overlay) (overlay-get yas--active-field-overlay 'yas--field)))) (if existing-field (progn (progn (or (and ... t) (signal ... ...)) (let* (...) (aset v 7 existing-field))) (yas--advance-end-maybe-previous-fields existing-field (overlay-end yas--active-field-overlay) (cdr yas--active-snippets))))) (if (progn (or (and (memq (type-of snippet) cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list 'yas--snippet snippet))) (aref snippet 2)) nil (yas-exit-snippet snippet)) (let ((first-field (car (progn (or ... ...) (aref snippet 2))))) (if first-field (progn (sit-for 0) (let ((envvar ...)) (progn (let* ... ... ...))) (if (and (eq ... 0) (> ... 0)) (progn (setq deactivate-mark nil)))))) (yas--message 4 "snippet %d expanded." (progn (or (and (memq (type-of snippet) cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list 'yas--snippet snippet))) (aref snippet 4))) t))
  (let ((content (if (and (memq (type-of snippet) cl-struct-yas--template-tags) t) (progn (or (and (memq ... cl-struct-yas--template-tags) t) (signal 'wrong-type-argument (list ... snippet))) (aref snippet 2)) snippet))) (if (and (not expand-env) (and (memq (type-of snippet) cl-struct-yas--template-tags) t)) (progn (setq expand-env (progn (or (and (memq ... cl-struct-yas--template-tags) t) (signal 'wrong-type-argument (list ... snippet))) (aref snippet 5))))) (cond ((listp content) (yas--eval-for-effect content)) (t (setq yas--start-column (current-column)) (let ((yas--inhibit-overlay-hooks t)) (setq snippet (yas--snippet-create content expand-env start (point)))) (let ((existing-field (and yas--active-field-overlay (overlay-buffer yas--active-field-overlay) (overlay-get yas--active-field-overlay ...)))) (if existing-field (progn (progn (or ... ...) (let* ... ...)) (yas--advance-end-maybe-previous-fields existing-field (overlay-end yas--active-field-overlay) (cdr yas--active-snippets))))) (if (progn (or (and (memq ... cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list ... snippet))) (aref snippet 2)) nil (yas-exit-snippet snippet)) (let ((first-field (car (progn ... ...)))) (if first-field (progn (sit-for 0) (let (...) (progn ...)) (if (and ... ...) (progn ...))))) (yas--message 4 "snippet %d expanded." (progn (or (and (memq ... cl-struct-yas--snippet-tags) t) (signal 'wrong-type-argument (list ... snippet))) (aref snippet 4))) t)))
  (let* ((clear-field (let ((field (and yas--active-field-overlay (overlay-buffer yas--active-field-overlay) (overlay-get yas--active-field-overlay ...)))) (and field (yas--skip-and-clear-field-p field (point) (point) 0) field))) (start (cond (start) ((region-active-p) (region-beginning)) (clear-field (progn (or (and ... t) (signal ... ...)) (aref clear-field 2))) (t (point)))) (end (cond (end) ((region-active-p) (region-end)) (clear-field (progn (or (and ... t) (signal ... ...)) (aref clear-field 3))) (t (point)))) (to-delete (and (> end start) (buffer-substring-no-properties start end))) (yas-selected-text (cond (yas-selected-text) ((and (region-active-p) (not clear-field)) to-delete)))) (goto-char start) (setq yas--indent-original-column (current-column)) (if to-delete (progn (delete-region start end))) (let ((content (if (and (memq (type-of snippet) cl-struct-yas--template-tags) t) (progn (or (and ... t) (signal ... ...)) (aref snippet 2)) snippet))) (if (and (not expand-env) (and (memq (type-of snippet) cl-struct-yas--template-tags) t)) (progn (setq expand-env (progn (or (and ... t) (signal ... ...)) (aref snippet 5))))) (cond ((listp content) (yas--eval-for-effect content)) (t (setq yas--start-column (current-column)) (let ((yas--inhibit-overlay-hooks t)) (setq snippet (yas--snippet-create content expand-env start (point)))) (let ((existing-field (and yas--active-field-overlay ... ...))) (if existing-field (progn (progn ... ...) (yas--advance-end-maybe-previous-fields existing-field ... ...)))) (if (progn (or (and ... t) (signal ... ...)) (aref snippet 2)) nil (yas-exit-snippet snippet)) (let ((first-field (car ...))) (if first-field (progn (sit-for 0) (let ... ...) (if ... ...)))) (yas--message 4 "snippet %d expanded." (progn (or (and ... t) (signal ... ...)) (aref snippet 4))) t))))
  yas-expand-snippet(#("SuscripcionTipo" 0 15 (fontified nil)) 82 97 nil)
  (let* ((inhibit-field-text-motion t) (offset (save-excursion (goto-char start) (back-to-indentation) (buffer-substring-no-properties (line-beginning-position) (point)))) (yas-indent-line (if keep-whitespace nil 'auto)) (yas-also-auto-indent-first-line nil) (indent-line-function (if (or lsp-enable-relative-indentation (derived-mode-p 'org-mode)) #'(lambda nil (save-excursion (forward-line 0) (insert offset))) indent-line-function))) (yas-expand-snippet (lsp--to-yasnippet-snippet snippet) start end expand-env))
  lsp--expand-snippet(#("SuscripcionTipo" 0 15 (fontified nil)) 82 97 nil nil)
  (progn (lsp--expand-snippet (buffer-substring start-point (point)) start-point (point) nil keep-whitespace\?))
  (if (equal insert-text-format\? lsp/insert-text-format-snippet) (progn (lsp--expand-snippet (buffer-substring start-point (point)) start-point (point) nil keep-whitespace\?)))
  (let* ((--dash-source-648-- (text-properties-at 0 candidate)) (item (plist-get --dash-source-648-- 'lsp-completion-item)) (start-point (plist-get --dash-source-648-- 'lsp-completion-start-point)) (markers (plist-get --dash-source-648-- 'lsp-completion-markers)) (prefix (plist-get --dash-source-648-- 'lsp-completion-prefix)) (label (gethash "label" item)) (insert-text\? (gethash "insertText" item)) (text-edit\? (gethash "textEdit" item)) (insert-text-format\? (gethash "insertTextFormat" item)) (additional-text-edits\? (gethash "additionalTextEdits" item)) (keep-whitespace\? (gethash "keepWhitespace" item))) (cond (text-edit\? (apply #'delete-region markers) (insert prefix) (lsp--apply-text-edit text-edit\?)) ((or insert-text\? label) (apply #'delete-region markers) (insert prefix) (delete-region start-point (point)) (insert (or insert-text\? label)))) (if (equal insert-text-format\? lsp/insert-text-format-snippet) (progn (lsp--expand-snippet (buffer-substring start-point (point)) start-point (point) nil keep-whitespace\?))) (if lsp-completion-enable-additional-text-edit (progn (if (or (get-text-property 0 'lsp-completion-resolved candidate) additional-text-edits\?) (lsp--apply-text-edits additional-text-edits\?) (let* ((--dash-source-650-- (lsp--create-apply-text-edits-handlers)) (callback (car-safe ...)) (cleanup-fn (car --dash-source-650--))) (lsp-completion--resolve-async item #'(lambda ... ...) cleanup-fn))))) (if (and lsp-signature-auto-activate (lsp-feature\? "textDocument/signatureHelp")) (progn (lsp-signature-activate))) (set (make-local-variable 'lsp-inhibit-lsp-hooks) nil) (if (lsp-completion--looking-back-trigger-characterp trigger-chars) (progn (setq this-command 'self-insert-command))))
  (unwind-protect (let* ((--dash-source-648-- (text-properties-at 0 candidate)) (item (plist-get --dash-source-648-- 'lsp-completion-item)) (start-point (plist-get --dash-source-648-- 'lsp-completion-start-point)) (markers (plist-get --dash-source-648-- 'lsp-completion-markers)) (prefix (plist-get --dash-source-648-- 'lsp-completion-prefix)) (label (gethash "label" item)) (insert-text\? (gethash "insertText" item)) (text-edit\? (gethash "textEdit" item)) (insert-text-format\? (gethash "insertTextFormat" item)) (additional-text-edits\? (gethash "additionalTextEdits" item)) (keep-whitespace\? (gethash "keepWhitespace" item))) (cond (text-edit\? (apply #'delete-region markers) (insert prefix) (lsp--apply-text-edit text-edit\?)) ((or insert-text\? label) (apply #'delete-region markers) (insert prefix) (delete-region start-point (point)) (insert (or insert-text\? label)))) (if (equal insert-text-format\? lsp/insert-text-format-snippet) (progn (lsp--expand-snippet (buffer-substring start-point (point)) start-point (point) nil keep-whitespace\?))) (if lsp-completion-enable-additional-text-edit (progn (if (or (get-text-property 0 'lsp-completion-resolved candidate) additional-text-edits\?) (lsp--apply-text-edits additional-text-edits\?) (let* ((--dash-source-650-- ...) (callback ...) (cleanup-fn ...)) (lsp-completion--resolve-async item #'... cleanup-fn))))) (if (and lsp-signature-auto-activate (lsp-feature\? "textDocument/signatureHelp")) (progn (lsp-signature-activate))) (set (make-local-variable 'lsp-inhibit-lsp-hooks) nil) (if (lsp-completion--looking-back-trigger-characterp trigger-chars) (progn (setq this-command 'self-insert-command)))) (lsp-completion--clear-cache))
  lsp-completion--exit-fn(#("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)) finished ["."])
  apply(lsp-completion--exit-fn (#("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)) finished ["."]))
  (closure ((args ["."]) (fn . lsp-completion--exit-fn) t) (&rest args-before) (apply fn (append args-before args)))(#("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)) finished)
  funcall((closure ((args ["."]) (fn . lsp-completion--exit-fn) t) (&rest args-before) (apply fn (append args-before args))) #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)) finished)
  (if exit-function (funcall exit-function arg (if (= (car (completion-boundaries arg table nil "")) (length arg)) 'sole 'finished)))
  (let* ((res company-capf--current-completion-data) (exit-function (plist-get (nthcdr 4 res) :exit-function)) (table (nth 3 res))) (if exit-function (funcall exit-function arg (if (= (car (completion-boundaries arg table nil "")) (length arg)) 'sole 'finished))))
  company--capf-post-completion(#("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)))
  (cond ((eq command 'interactive) (company-begin-backend 'company-capf)) ((eq command 'prefix) (let ((res (company--capf-data))) (if res (progn (let ((length ...) (prefix ...)) (cond (... ...) (length ...) (t prefix))))))) ((eq command 'candidates) (company-capf--candidates arg)) ((eq command 'sorted) company-capf--sorted) ((eq command 'match) (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) :company-match))) (if f (funcall f arg) (let* ((match-start nil) (pos -1) (prop-value nil) (faces nil) (has-face-p nil) chunks (limit (length arg))) (while (< pos limit) (setq pos (if ... 0 ...)) (setq prop-value (or ... ...) faces (if ... prop-value ...) has-face-p (memq ... faces)) (cond (... ...) (... ... ...))) (nreverse chunks))))) ((eq command 'duplicates) t) ((eq command 'no-cache) t) ((eq command 'meta) (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) :company-docsig))) (if f (progn (funcall f arg))))) ((eq command 'doc-buffer) (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) :company-doc-buffer))) (if f (progn (funcall f arg))))) ((eq command 'location) (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) :company-location))) (if f (progn (funcall f arg))))) ((eq command 'annotation) (let ((f (plist-get (nthcdr 4 company-capf--current-completion-data) :annotation-function))) (if f (progn (funcall f arg))))) ((eq command 'require-match) (plist-get (nthcdr 4 (company--capf-data)) :company-require-match)) ((or (eq command 'init) (not (eq command 'post-completion))) nil) (t (company--capf-post-completion arg)))
  company-capf(post-completion #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)))
  apply(company-capf (post-completion #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>))))
  (if (functionp company-backend) (apply company-backend args) (apply #'company--multi-backend-adapter company-backend args))
  (condition-case err (if (functionp company-backend) (apply company-backend args) (apply #'company--multi-backend-adapter company-backend args)) ((debug user-error) (user-error "Company: backend %s user-error: %s" company-backend (error-message-string err))) ((debug error) (error "Company: backend %s error \"%s\" with args %s" company-backend (error-message-string err) args)))
  company-call-backend-raw(post-completion #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)))
  apply(company-call-backend-raw (post-completion #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>))))
  (let ((value (apply fun args))) (if (not (eq (car-safe value) :async)) value (let ((res 'trash) (start (time-to-seconds))) (funcall (cdr value) #'(lambda (result) (setq res result))) (while (eq res 'trash) (if (> (- (time-to-seconds) start) company-async-timeout) (error "Company: backend %s async timeout with args %s" backend args) (sleep-for company-async-wait))) res)))
  company--force-sync(company-call-backend-raw (post-completion #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>))) company-capf)
  company-call-backend(post-completion #("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)))
  (let ((company-backend backend)) (run-hook-with-args 'company-completion-finished-hook result) (company-call-backend 'post-completion result))
  (if (stringp result) (let ((company-backend backend)) (run-hook-with-args 'company-completion-finished-hook result) (company-call-backend 'post-completion result)) (run-hook-with-args 'company-completion-cancelled-hook result))
  (progn (if (stringp result) (let ((company-backend backend)) (run-hook-with-args 'company-completion-finished-hook result) (company-call-backend 'post-completion result)) (run-hook-with-args 'company-completion-cancelled-hook result)) (run-hook-with-args 'company-after-completion-hook result))
  (if prefix (progn (if (stringp result) (let ((company-backend backend)) (run-hook-with-args 'company-completion-finished-hook result) (company-call-backend 'post-completion result)) (run-hook-with-args 'company-completion-cancelled-hook result)) (run-hook-with-args 'company-after-completion-hook result)))
  (let ((prefix company-prefix) (backend company-backend)) (setq company-backend nil company-prefix nil company-candidates nil company-candidates-length nil company-candidates-cache nil company-candidates-predicate nil company-common nil company-selection 0 company-selection-changed nil company--manual-action nil company--manual-prefix nil company--point-max nil company-point nil) (if company-timer (progn (cancel-timer company-timer))) (company-echo-cancel t) (company-search-mode 0) (company-call-frontends 'hide) (company-enable-overriding-keymap nil) (if prefix (progn (if (stringp result) (let ((company-backend backend)) (run-hook-with-args 'company-completion-finished-hook result) (company-call-backend 'post-completion result)) (run-hook-with-args 'company-completion-cancelled-hook result)) (run-hook-with-args 'company-after-completion-hook result))))
  company-cancel(#("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)))
  company-finish(#("SuscripcionTipo" 0 1 (face (completions-common-part) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 1 2 (face (completions-first-difference) lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>) 2 15 (lsp-completion-prefix "S" lsp-completion-markers (82 #<marker (moves after insertion) at 97 in response.go>) lsp-completion-start-point 82 lsp-sort-text "00000" lsp-completion-item #<hash-table equal 11/15 0x158c01ad5b9d>)))
  (let ((result (nth company-selection company-candidates))) (company-finish result))
  (progn (let ((result (nth company-selection company-candidates))) (company-finish result)))
  (if (company-manual-begin) (progn (let ((result (nth company-selection company-candidates))) (company-finish result))))
  company-complete-selection()
  funcall-interactively(company-complete-selection)
  call-interactively(company-complete-selection nil nil)
  command-execute(company-complete-selection)

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

re-compiled my Emacs (version 28.x) and since I can trigger this bug in my GNU/Linux machine I came with a snippet that triggers the issue, after that if I save the modified file Emacs have an exception:

✖ emacs
emacs: src/./parser.c:877: ts_parser__accept: La declaración `ts_subtree_is_eof(lookahead)' no se cumple.
Fatal error 6: Aborted
Backtrace:
emacs(+0x14ffc2)[0x557ffb46cfc2]
emacs(+0x4233e)[0x557ffb35f33e]
emacs(+0x429bf)[0x557ffb35f9bf]
emacs(+0x2501be)[0x557ffb56d1be]
/usr/lib/libc.so.6(+0x3c3e0)[0x7f6c68ecb3e0]
/usr/lib/libc.so.6(gsignal+0x145)[0x7f6c68ecb355]
/usr/lib/libc.so.6(abort+0x127)[0x7f6c68eb4853]
/usr/lib/libc.so.6(+0x25727)[0x7f6c68eb4727]
/usr/lib/libc.so.6(+0x34936)[0x7f6c68ec3936]
/home/jorge/.emacs.d/straight/build/tree-sitter/tree-sitter-dyn.so(+0x148ee3)[0x7f6c5777eee3]
/home/jorge/.emacs.d/straight/build/tree-sitter/tree-sitter-dyn.so(+0x14e88a)[0x7f6c5778488a]
/home/jorge/.emacs.d/straight/build/tree-sitter/tree-sitter-dyn.so(+0x1311ff)[0x7f6c577671ff]
/home/jorge/.emacs.d/straight/build/tree-sitter/tree-sitter-dyn.so(+0x1316af)[0x7f6c577676af]
emacs(+0x1e2d8a)[0x557ffb4ffd8a]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1f5b56)[0x557ffb512b56]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1f5b56)[0x557ffb512b56]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1b9b89)[0x557ffb4d6b89]
emacs(+0x1b872d)[0x557ffb4d572d]
emacs(+0x1627ef)[0x557ffb47f7ef]
emacs(+0x1659d2)[0x557ffb4829d2]
emacs(+0x1f8b82)[0x557ffb515b82]
emacs(+0x1b95f9)[0x557ffb4d65f9]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1f5b56)[0x557ffb512b56]
emacs(+0x1b95f9)[0x557ffb4d65f9]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1f5b56)[0x557ffb512b56]
emacs(+0x1b95f9)[0x557ffb4d65f9]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1f5b56)[0x557ffb512b56]
emacs(+0x1b95f9)[0x557ffb4d65f9]
emacs(+0x1b9a27)[0x557ffb4d6a27]
emacs(+0x1b9b89)[0x557ffb4d6b89]
emacs(+0x1b87b9)[0x557ffb4d57b9]
emacs(+0x1b8864)[0x557ffb4d5864]
emacs(+0x1b9af3)[0x557ffb4d6af3]
emacs(+0x1f5b56)[0x557ffb512b56]
emacs(+0x1b9a27)[0x557ffb4d6a27]
...
zsh: abort (core dumped)  emacs

any pointers on how to get more information of this core dump?

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

indeed, @ubolonton, I'm having troubles narrowing what is causing this issue in my configuration.

I was able to reproduce 10/10 times the error with the following snippet:

(with-current-buffer (find-file-noselect "/tmp/test/main.go") ;; file must exist and be empty
  (company-complete-selection))

I have deleted a bunch of unused packages in my configuration https://github.com/shackra/emacs

from elisp-tree-sitter.

shackra avatar shackra commented on April 24, 2024

I've updated some packages on my end:

and seems like the issue is gone now. I'll re-open this issue if happens again.

these are the commits I have for some of those packages before updating shackra/emacs@6ad8e87

from elisp-tree-sitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.