Subject: 30.0.50; Issue with tree-sitter syntax tree during certain changes

From: Wilhelm Kirschbaum <[email-masked]>
Date: Tue, 21 Mar 2023 16:00:04 +0200

With the following text in a buffer with elixir-ts-mode:

def foo() do
end

When I delete the `)` and re-insert it, the tree-sitter syntax 
tree does
not fully recover and the `do end` part is absent when observing 
using
treesit-explore-mode.

Before removing the `)`:

(source
 (call target: (identifier)
  (arguments
   (call target: (identifier)
    (arguments ( ))))
  (do_block do end)))

after re-inserting `)`:

(source
 (call target: (identifier)
  (arguments
   (call target: (identifier)
    (arguments ( ))))))

I can see the same behaviour using ruby-ts-mode when I remove the
following expression:

(setq-local syntax-propertize-function 
#'ruby-ts--syntax-propertize)

The ruby syntax I tested with:

def foo()
end

When I add a local `syntax-propertize-function' function to 
elixir-ts-mode
it also solves the problem of not fully recovering the tree-sitter
syntax tree.  It does not seem to matter what the function 
achieves
thought, so am a bit confused.

In GNU Emacs 30.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.17.8) of 2023-03-20 built on 
 melissa.local
Repository revision: 42fba8f36b19536964d6deb6a34f3fd1c02b43dd
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation=aot --with-tree-sitter 
 --with-json
 --with-pgtk'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ 
JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY 
PDUMPER
PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF 
TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM GTK3 ZLIB
Important settings:
  value of $LANG: en_ZA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Elixir

Minor modes in effect:
  electric-pair-mode: t
  erc-notifications-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-netsplit-mode: t
  erc-log-mode: t
  erc-services-mode: t
  erc-spelling-mode: t
  erc-match-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  display-line-numbers-mode: t
  flyspell-mode: t
  whitespace-mode: t
  global-floatpays-mode: t
  floatpays-mode: t
  marginalia-mode: t
  savehist-mode: t
  vertico-mode: t
  global-corfu-mode: t
  corfu-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  flymake-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  which-key-mode: t
  override-global-mode: t
  global-treesit-auto-mode: t
  treesit-explore-mode: t
  pixel-scroll-precision-mode: t
  repeat-mode: t
  winner-mode: t
  save-place-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/wilhelm/.config/emacs/elpa/transient-20230315.1520/transient 
hides /usr/local/share/emacs/30.0.50/lisp/transient

Features:
(shadow view emacsbug shortdoc cus-start elec-pair descr-text 
sgml-mode
facemenu ruby-ts-mode ruby-mode em-unix em-term term ehelp 
em-script
em-prompt em-pred em-ls em-hist em-glob em-extpipe em-cmpl em-dirs
em-basic em-banner em-alias esh-mode esh-var eshell esh-cmd 
esh-ext
esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
tramp-cmds tramp-archive tramp-gvfs tramp tramp-loaddefs trampver
tramp-integration tramp-compat ls-lisp cl-print consult-imenu 
c-ts-mode
pulse jka-compr help-fns radix-tree consult-xref char-fold 
heex-ts-mode
elixir-ts-mode-tests ert-x dired-aux vc-hg vc-bzr vc-src vc-sccs 
vc-cvs
vc-rcs gnus-dired diff-hl-dired erts-mode misearch multi-isearch
goto-addr files-x git-rebase magit-extras face-remap cape 
network-stream
erc-desktop-notifications erc-imenu epa-file erc-image image-dired
image-dired-tags image-dired-external image-dired-util image-mode 
exif
erc-list erc-menu erc-join erc-ring erc-pcomplete erc-track 
erc-netsplit
erc-log erc-services erc-spelling erc-match erc-hl-nicks 
erc-button
erc-fill erc-stamp erc-goodies erc erc-backend erc-networks 
erc-common
erc-compat erc-loaddefs cursor-sensor display-line-numbers 
flyspell
ispell disp-table whitespace init.el mu4e-alert time ht alert 
log4e
notifications gntp mu4e mu4e-org mu4e-main mu4e-view gnus-art 
mm-uu
mml2015 mm-view mml-smime smime dig gnus-sum gnus-group gnus-undo
gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source 
utf7 nnoo
gnus-spec gnus-int gnus-range gnus-win gnus nnheader range 
mu4e-headers
mu4e-compose mu4e-draft mu4e-actions smtpmail mu4e-search 
mu4e-lists
mu4e-bookmarks mu4e-mark mu4e-message flow-fill mule-util hl-line
mu4e-contacts mu4e-update mu4e-folders mu4e-server mu4e-context
mu4e-obsolete mu4e-vars mu4e-helpers mu4e-config ido srht plz verb 
js
c-ts-common denote mastodon mastodon-toot mastodon-iso persist
mastodon-http request flycheck-package package-build
package-build-badges package-recipe package-lint finder lisp-mnt 
eat
elfeed-show elfeed-search shr pixel-fill kinsoku elfeed-csv elfeed
elfeed-curl elfeed-log elfeed-db elfeed-lib url-queue url-file 
xml-query
fontaine modus-vivendi-theme modus-themes embark-consult 
consult-vertico
consult magit-bookmark bookmark embark-org org-element org-persist 
xdg
org-id org-refile avl-tree embark ffap marginalia savehist 
orderless
vertico kind-icon svg-lib svg dom xml corfu-terminal popon corfu 
eglot
external-completion array ert debug backtrace jsonrpc posframe
yasnippet-snippets yasnippet flycheck avy org-toc org-contrib 
org-clock
ob-shell ob-elixir async ob-async org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc 
org-loaddefs
cal-menu calendar cal-loaddefs org-version org-compat org-macs 
yaml-mode
terraform-mode hcl-mode php-mode mode-local find-func speedbar 
ezimage
dframe cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles 
cc-align
php-face php php-project flymake-proc flymake cc-engine cc-vars 
cc-defs
erlang-start erlang etags fileloop generator xref project tempo 
align
mix use-package-bind-key elixir-ts-mode dockerfile-mode sh-script 
smie
executable pcmpl-args pcmpl-linux pcmpl-unix git-modes 
gitignore-mode
gitconfig-mode conf-mode gitattributes-mode diff-hl log-view 
vc-dir ewoc
vc forge-list forge-commands forge-semi forge-bitbucket buck 
forge-gogs
gogs forge-gitea gtea forge-gitlab glab forge-github ghub-graphql 
treepy
gsexp ghub url-http url-gw nsm url-auth let-alist gnutls 
forge-notify
forge-revnote forge-pullreq forge-issue forge-topic yaml 
parse-time
iso8601 bug-reference forge-post markdown-mode color forge-repo 
forge
forge-core forge-db closql emacsql-sqlite emacsql-sqlite-common 
emacsql
emacsql-compiler git-timemachine vc-git vc-dispatcher 
magit-submodule
magit-blame magit-stash magit-reflog magit-bisect magit-push 
magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log magit-diff smerge-mode diff 
diff-mode
git-commit log-edit message sendmail yank-media puny rfc822 mml 
mml-sec
epa epg rfc6068 epg-config gnus-util time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util 
add-log
magit-core magit-autorevert magit-margin magit-transient 
magit-process
with-editor comp comp-cstr warnings rx shell pcomplete server 
magit-mode
transient magit-git magit-base magit-section format-spec crm 
compat
functions restclient advice noutline outline which-key ripgrep 
thingatpt
grep ag vc-svn compile text-property-search comint ansi-osc 
ansi-color
find-dired s dired-rainbow dired-subtree dired-hacks-utils dash 
dired
dired-loaddefs all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons
data-alltheicons exec-path-from-shell edmacro kmacro bind-key 
easy-mmode
use-package-ensure use-package-core finder-inf 
erc-hl-nicks-autoloads
forge-autoloads php-mode-autoloads kind-icon-autoloads 
erlang-autoloads
eat-autoloads flycheck-package-autoloads package-lint-autoloads
mastodon-autoloads persist-autoloads request-autoloads 
ripgrep-autoloads
terraform-mode-autoloads dired-subtree-autoloads 
yaml-mode-autoloads
avy-autoloads closql-autoloads srht-autoloads plz-autoloads
markdown-mode-autoloads verb-autoloads restclient-autoloads
embark-consult-autoloads embark-autoloads erc-image-autoloads
mu4e-alert-autoloads elfeed-autoloads cape-autoloads
marginalia-autoloads hcl-mode-autoloads corfu-terminal-autoloads
popon-autoloads package-build-autoloads derived yaml-autoloads
dockerfile-mode-autoloads treesit-auto-autoloads treesit-auto 
treesit
magit-autoloads pcase git-timemachine-autoloads 
emmet-mode-autoloads
ht-autoloads org-roam-autoloads magit-section-autoloads
emacsql-autoloads ag-autoloads posframe-autoloads
yasnippet-snippets-autoloads yasnippet-autoloads 
which-key-autoloads
ox-hugo-autoloads fontaine-autoloads diff-hl-autoloads
ob-async-autoloads async-autoloads all-the-icons-autoloads 
ts-autoloads
exunit-autoloads denote-autoloads f-autoloads s-autoloads
git-modes-autoloads tomelr-autoloads vertico-autoloads
flycheck-autoloads pkg-info-autoloads epl-autoloads deft-autoloads
git-commit-autoloads with-editor-autoloads ob-elixir-autoloads
pcmpl-args-autoloads consult-dir-autoloads consult-autoloads
mix-autoloads dired-rainbow-autoloads dired-hacks-utils-autoloads
orderless-autoloads dash-autoloads alert-autoloads log4e-autoloads
gntp-autoloads ghub-autoloads treepy-autoloads corfu-autoloads
org-contrib-autoloads web-mode-autoloads transient-autoloads info
compat-autoloads exec-path-from-shell-autoloads svg-lib-autoloads
package browse-url url url-proxy url-privacy url-expand 
url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util 
mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
password-cache json map byte-opt gv bytecomp byte-compile url-vars
native cl-extra help-mode pixel-scroll cua-base subr-x repeat 
winner
ring saveplace which-func imenu autorevert filenotify cus-edit pp
cus-load icons wid-edit cl-loaddefs cl-lib early-init rmc 
iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win 
term/common-win
pgtk-dnd tool-bar dnd fontset image regexp-opt fringe 
tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page 
tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar 
mouse
jit-lock font-lock syntax font-core term/tty-colors frame 
minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech 
european
ethiopic indian cyrillic chinese composite emoji-zwj charscript 
charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face 
macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable 
backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty 
make-network-process
native-compile emacs)

Memory information:
((conses 16 1519596 4641956)
 (symbols 48 97383 393)
 (strings 32 400012 126802)
 (string-bytes 1 12971136)
 (vectors 16 149074)
 (vector-slots 8 4019930 2141693)
 (floats 8 1373 14870)
 (intervals 56 61927 21199)
 (buffers 984 80))