emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
815 stars 73 forks source link

[fix] `tsc-dyn-get--recorded-version`: support new DYN-VERSION syntax #249

Closed domq closed 7 months ago

domq commented 1 year ago

Previously, a tree-sitter DYN-VERSION file used to look like this:

0.18.0
(with no final newlines). Now it may look like this:pre>emacs-tree-sitter@0.18.0</pre (still sans final newlines).

In tsc-dyn-get--recorded-version, support both formats by erasing everything up to and including first @

domq commented 1 year ago

Hello @ubolonton, would you be so kind as to approve this pull request?

getong commented 7 months ago

@jcs090218 Would you merge this pr, I have the same error msg.

[2023-12-06T05:52:12.737495] tsc-dyn-get: Using source :compilation (:loaded nil :recorded emacs-tree-sitter@0.18.0 :requested 0.18.0)
[2023-12-06T05:52:12.749085] Could not get ‘tsc-dyn’: (error Invalid version syntax: ‘emacs-tree-sitter@0.18.0’ (must start with a number))
jcs090218 commented 7 months ago

This makes sense to me! Thank you to everyone who participated in this bug!

getong commented 7 months ago

how about making a new tag?

jcs090218 commented 7 months ago

It seems like there is an error with our release pipeline. I will try to fix it ASAP. 🤔

ubolonton commented 6 months ago

This is a version:

0.18.0

This is not:

emacs-tree-sitter@0.18.0

Please fix the things that write incorrect data into DYN-VERSION instead.

This file is also updated by tsc-dyn-get--github.

meedstrom commented 2 months ago

@jcs090218 I have no familiarity with this codebase, but I would actually suggest to change the code that asks cargo for the version to write to DYN-VERSION in the first place. Then everything should be correct from the beginning.

This function:

(defun tsc-dyn-get--build-version ()
  "Return the dynamic module's version after asking 'cargo'."
  (thread-first (shell-command-to-string "cargo pkgid")
    string-trim
    (split-string "\[#:\]")
    last car))

For the split-string, just add a @.

(defun tsc-dyn-get--build-version ()
  "Return the dynamic module's version after asking 'cargo'."
  (thread-first (shell-command-to-string "cargo pkgid")
    string-trim
    (split-string "\[#@:\]")
    last car))

Then this PR can be reverted, resulting in fewer s-exps.