orzechowskid / tsx-mode.el

a batteries-included Emacs major mode for Typescript, Javascript, TSX, and JSX files
GNU General Public License v3.0
103 stars 11 forks source link

Doesn't work on Emacs29 / NixOS #46

Closed YievCkim closed 10 months ago

YievCkim commented 10 months ago

Hi,

I have followed your instruction all dependencies are installed. This is my configuration:

  '("elpa-devel" . "https://elpa.gnu.org/devel/packages/") t)

(package-initialize)
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        (or (bound-and-true-p straight-base-dir)
            user-emacs-directory)))
      (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

;; (straight-use-package 'lsp-mode)
(straight-use-package 'coverlay)
(straight-use-package '(css-in-js-mode :type git :host github :repo "orzechowskid/tree-sitter-css-in-js"))
(straight-use-package '(tsi :type git :host github :repo "orzechowskid/tsi.el"))
(straight-use-package '(tsx-mode :type git :host github :repo "orzechowskid/tsx-mode.el" ))

(add-to-list 'load-path (expand-file-name "/home/mik/.emacs.d/origami.el/"))
(require 'origami)

Emacs 29 is built with tree-sitter:

system-configuration-options is a variable defined in ‘C source code’.

Its value is
"--prefix=/nix/store/0g4xxdsn4xp9qhgc4cylbksqpwsn51vc-emacs-29.1 --disable-build-details --with-modules --with-x-toolkit=lucid --with-xft --with-cairo --with-native-compilation --with-tree-sitter --with-xinput2"

String containing the configuration options Emacs was built with.

But when I try to use tsx-mode I got this warnings and tsx file doesn't seem to be handled (no syntax highlighting):

⛔ Warning (comp): lsp-wgsl.el:179:2: Warning: ‘wgsl-analyzer/requestConfiguration’ is a malformed function
⛔ Warning (comp): lsp-wgsl.el:198:24: Warning: reference to free variable ‘lsp-wgsl’
⛔ Warning (comp): lsp-wgsl.el:198:2: Warning: the function ‘lsp-consistency-check’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:192:42: Warning: the function ‘lsp-package-ensure’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:190:35: Warning: the function ‘lsp-activate-on’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:188:40: Warning: the function ‘lsp--set-configuration’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:185:38: Warning: the function ‘with-lsp-workspace’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:182:43: Warning: the function ‘lsp-package-path’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:180:36: Warning: the function ‘lsp-stdio-connection’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:180:3: Warning: the function ‘make-lsp-client’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:179:2: Warning: the function ‘lsp-register-client’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:173:2: Warning: the function ‘lsp-dependency’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:161:22: Warning: the function ‘lsp--region-to-range’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:141:36: Warning: the function ‘lsp--buffer-uri’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:139:4: Warning: the function ‘lsp-request-async’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:117:41: Warning: the function ‘lsp-json-bool’ is not known to be defined.
⛔ Warning (comp): lsp-wgsl.el:98:37: Warning: the function ‘lsp-ht’ is not known to be defined.
⛔ Warning (comp): eldoc.el:690:35: Warning: ‘eldoc--make-callback’ called with 2 arguments, but accepts only 1
⛔ Warning (comp): eldoc.el:701:40: Warning: ‘eldoc--make-callback’ called with 2 arguments, but accepts only 1
⛔ Warning (comp): eldoc.el:715:41: Warning: ‘eldoc--make-callback’ called with 2 arguments, but accepts only 1
⛔ Warning (comp): eldoc.el:726:41: Warning: ‘eldoc--make-callback’ called with 2 arguments, but accepts only 1
⛔ Warning (comp): eldoc.el:831:8: Warning: function eldoc--make-callback used to take 1 argument, now takes 2
⛔ Warning (comp): lsp-json.el:38:2: Warning: custom-declare-variable `lsp-json-schemas' docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:188:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:188:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): coverlay.el:198:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:198:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): coverlay.el:221:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:400:18: Warning: ‘point-at-bol’ is an obsolete function (as of 29.1); use ‘line-beginning-position’ or ‘pos-bol’ instead.
⛔ Warning (comp): coverlay.el:400:45: Warning: ‘point-at-eol’ is an obsolete function (as of 29.1); use ‘line-end-position’ or ‘pos-eol’ instead.
⛔ Warning (comp): coverlay.el:512:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:512:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): coverlay.el:524:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:524:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): coverlay.el:528:2: Warning: docstring wider than 80 characters
⛔ Warning (comp): coverlay.el:528:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): coverlay.el:588:54: Warning: Alias for ‘coverlay-minor-mode-hook’ should be declared before its referent
⛔ Warning (comp): tsc-dyn-get.el:185:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): css-in-js-mode.el:158:2: Warning: defvar `css-in-js-mode--font-lock-feature-list' docstring wider than 80 characters
⛔ Warning (comp): css-in-js-mode.el:198:53: Warning: Unused lexical argument `override'
⛔ Warning (comp): css-in-js-mode.el:198:62: Warning: Unused lexical argument `start'
⛔ Warning (comp): css-in-js-mode.el:198:68: Warning: Unused lexical argument `end'
⛔ Warning (comp): css-in-js-mode.el:216:44: Warning: Unused lexical argument `start'
⛔ Warning (comp): css-in-js-mode.el:216:50: Warning: Unused lexical argument `end'
⛔ Warning (comp): css-in-js-mode.el:218:9: Warning: reference to free variable ‘css-in-js-mode’
⛔ Warning (comp): css-in-js-mode.el:244:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): tree-sitter-hl.el:263:2: Warning: custom-declare-variable `tree-sitter-hl-face-mapping-function' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): tree-sitter-hl.el:487:12: Warning: ‘inhibit-point-motion-hooks’ is an obsolete variable (as of 25.1); use ‘cursor-intangible-mode’ or ‘cursor-sensor-mode’ instead
⛔ Warning (comp): tree-sitter-hl.el:639:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): /home/mik/.emacs.d/straight/build/tsi/tsi.test.el: Error: File is missing Cannot open load file
⛔ Warning (comp): tsi-typescript.test.el:11:7: Warning: assignment to free variable ‘tsi--test-indent-fn’
⛔ Warning (comp): tsi-typescript.test.el:744:2: Warning: the function ‘buttercup-run-discover’ is not known to be defined.
⛔ Warning (comp): tsi-typescript.test.el:16:7: Warning: the function ‘expect’ is not known to be defined.
⛔ Warning (comp): tsi-typescript.test.el:15:3: Warning: the function ‘it’ is not known to be defined.
⛔ Warning (comp): tsi-typescript.test.el:13:2: Warning: the function ‘describe’ is not known to be defined.
⛔ Warning (comp): tsi-typescript.el:481:17: Warning: reference to free variable ‘tsi-typescript-mode-map’
⛔ Warning (comp): tsi.el:25:2: Warning: defvar `tsi-debug' docstring wider than 80 characters
⛔ Warning (comp): tsi.el:76:14: Warning: ‘tree-sitter-node-at-point’ is an obsolete function (as of 2021-08-30); use ‘tree-sitter-node-at-pos’ instead.
⛔ Warning (comp): tsi.el:107:9: Warning: Unused lexical variable `empty-line'
⛔ Warning (comp): tsi.el:116:13: Warning: ‘tree-sitter-node-at-point’ is an obsolete function (as of 2021-08-30); use ‘tree-sitter-node-at-pos’ instead.
⛔ Warning (comp): tsi.el:125:14: Warning: ‘tree-sitter-node-at-point’ is an obsolete function (as of 2021-08-30); use ‘tree-sitter-node-at-pos’ instead.
⛔ Warning (comp): tsi-json.test.el:11:7: Warning: assignment to free variable ‘tsi--test-indent-fn’
⛔ Warning (comp): tsi-json.test.el:48:2: Warning: the function ‘buttercup-run-discover’ is not known to be defined.
⛔ Warning (comp): tsi-json.test.el:16:7: Warning: the function ‘expect’ is not known to be defined.
⛔ Warning (comp): tsi-json.test.el:15:3: Warning: the function ‘it’ is not known to be defined.
⛔ Warning (comp): tsi-json.test.el:13:2: Warning: the function ‘describe’ is not known to be defined.
⛔ Warning (comp): tsi-json.el:41:11: Warning: Unused lexical variable `current-type'
⛔ Warning (comp): tsi-json.el:109:17: Warning: reference to free variable ‘tsi-json-mode-map’
⛔ Warning (comp): tsi-css.test.el:11:7: Warning: assignment to free variable ‘tsi--test-indent-fn’
⛔ Warning (comp): tsi-css.test.el:114:2: Warning: the function ‘buttercup-run-discover’ is not known to be defined.
⛔ Warning (comp): tsi-css.test.el:16:7: Warning: the function ‘expect’ is not known to be defined.
⛔ Warning (comp): tsi-css.test.el:15:3: Warning: the function ‘it’ is not known to be defined.
⛔ Warning (comp): tsi-css.test.el:13:2: Warning: the function ‘describe’ is not known to be defined.
⛔ Warning (comp): tsi-css.el:138:17: Warning: reference to free variable ‘tsi-css-mode-map’
⛔ Warning (comp): tsx-mode.el:35:2: Warning: custom-declare-variable `tsx-mode-code-fold-queries' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
⛔ Warning (comp): tsx-mode.el:96:28: Warning: Alias for ‘tsx-mode-use-jsx-auto-tags’ should be declared before its referent
⛔ Warning (comp): tsx-mode.el:100:32: Warning: Alias for ‘tsx-mode-code-fold-queries’ should be declared before its referent
⛔ Warning (comp): tsx-mode.el:121:54: Warning: Unused lexical argument `start'
⛔ Warning (comp): tsx-mode.el:158:12: Warning: Unused lexical argument `content'
⛔ Warning (comp): tsx-mode.el:162:14: Warning: reference to free variable ‘tsx-mode--code-fold-query’
⛔ Warning (comp): tsx-mode.el:251:10: Warning: reference to free variable ‘current-named-node-type’
⛔ Warning (comp): tsx-mode.el:356:7: Warning: reference to free variable ‘origami-parser-alist’
⛔ Warning (comp): tsx-mode.el:356:7: Warning: assignment to free variable ‘origami-parser-alist’
⛔ Warning (comp): tsx-mode.el:358:11: Warning: assignment to free variable ‘tsx-mode--code-fold-query’
⛔ Warning (comp): tsx-mode.el:370:6: Warning: the function ‘corfu-popupinfo-mode’ is not known to be defined.
⛔ Warning (comp): tsx-mode.el:369:6: Warning: the function ‘corfu-mode’ is not known to be defined.
⛔ Warning (comp): tsx-mode.el:363:6: Warning: the function ‘origami-mode’ is not known to be defined.
⛔ Warning (comp): tsx-mode.el:305:6: Warning: the function ‘origami-toggle-all-nodes’ is not known to be defined.
⛔ Warning (comp): tsx-mode.el:298:6: Warning: the function ‘origami-toggle-node’ is not known to be defined.
⛔ Warning (comp): tsx-mode.el:250:28: Warning: the function ‘treesit-node-at-pos’ is not known to be defined.
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for typescript is unavailable (not-found): (libtree-sitter-typescript libtree-sitter-typescript.0 libtree-sitter-typescript.0.0 libtree-sitter-typescript.so libtree-sitter-typescript.so.0 libtree-sitter-typescript.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for tsx is unavailable (not-found): (libtree-sitter-tsx libtree-sitter-tsx.0 libtree-sitter-tsx.0.0 libtree-sitter-tsx.so libtree-sitter-tsx.so.0 libtree-sitter-tsx.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for tsx is unavailable (not-found): (libtree-sitter-tsx libtree-sitter-tsx.0 libtree-sitter-tsx.0.0 libtree-sitter-tsx.so libtree-sitter-tsx.so.0 libtree-sitter-tsx.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for tsx is unavailable (not-found): (libtree-sitter-tsx libtree-sitter-tsx.0 libtree-sitter-tsx.0.0 libtree-sitter-tsx.so libtree-sitter-tsx.so.0 libtree-sitter-tsx.so.0.0) No such file or directory

Where I can find these language gramar files ?

YievCkim commented 10 months ago

Ok need to install grammars.

    ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (
      epkgs: [ epkgs.vterm epkgs.treesit-grammars.with-all-grammars]
    )

https://nixos.wiki/wiki/Emacs