Giter VIP home page Giter VIP logo

Comments (12)

seagle0128 avatar seagle0128 commented on May 30, 2024

For ts files, you should install both typescript and tsx via treesit-install-language-server.

No prompt because typescript-ts-mode and tsx-ts-mode are put in the fallback list. It's by designed of treesit-auto. See treesit-auto-fallback-alist.

treesit-available-p does not appear to be defined, tried to look for it in C-h v but could not find a variable called that. Is this supposed to be set by something?

treesit-available-p is a function.

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024
Cloning repository
Compiling library
Library installed to ~/.emacs.d/tree-sitter/libtree-sitter-typescript.so
Cloning repository
Compiling library
Library installed to ~/.emacs.d/tree-sitter/libtree-sitter-tsx.so
Cloning repository
Compiling library
Library installed to ~/.emacs.d/tree-sitter/libtree-sitter-javascript.so
$ ls ~/.emacs.d/tree-sitter 
libtree-sitter-bash.so        libtree-sitter-c.so           libtree-sitter-html.so        libtree-sitter-make.so      libtree-sitter-tsx.so
libtree-sitter-bibtex.so      libtree-sitter-css-in-js.so   libtree-sitter-javascript.so  libtree-sitter-markdown.so  libtree-sitter-typescript.so
libtree-sitter-clojure.so     libtree-sitter-css.so         libtree-sitter-java.so        libtree-sitter-python.so    libtree-sitter-yaml.so
libtree-sitter-cmake.so       libtree-sitter-dockerfile.so  libtree-sitter-json.so        libtree-sitter-r.so
libtree-sitter-commonlisp.so  libtree-sitter-elisp.so       libtree-sitter-julia.so       libtree-sitter-ruby.so
libtree-sitter-cpp.so         libtree-sitter-gomod.so       libtree-sitter-latex.so       libtree-sitter-rust.so
libtree-sitter-c-sharp.so     libtree-sitter-go.so          libtree-sitter-lua.so         libtree-sitter-toml.so

Then closed emacs, reopened, and opened the ts file, still seeing typescript-mode instead of typescript-ts-mode

major-mode is a buffer-local variable defined in buffer.c.

Value in #<buffer selectors.test.ts>
typescript-mode

Original Value
fundamental-mode

It is supposed to be typescript-ts-mode right? Maybe I'm just missing something else.

I created a test .c file and it appears tree sitter is working for that.

major-mode is a buffer-local variable defined in buffer.c.

Value in #<buffer test.c>
c-ts-mode

Original Value
fundamental-mode

from .emacs.d.

seagle0128 avatar seagle0128 commented on May 30, 2024

I tested on my local env, and it works well.

Did you try without your personal config? e.g. rename custom-post.el. I noticed this in it.

https://github.com/acdoussan/configs/blob/9e9f9ffa9eb60360df48fdf5632544c0c59de477/.emacs.d/custom-post.el#L115.

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

I did mv custom-post.el custom-post-bak.el, restarted emacs, and still seeing the same behavior. I also tried commenting out that line, lines 62-64, and I also removed tree-sitter, tree-sitter-langs, rsjx-mode, and json-mode from line 50, and also ran package-remove on those dependencies as well. Still just get typescript-mode for .ts files

Going to try completely reinstalling with the aforementioned changes.

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

Alright, this is probably a hint, after doing rm -rf ~./emacs.d and then reinstalling with the above changes (also committed now) typescript and tsx no longer show as an option when running treesit-install-language-grammar. Is this expected?

You mentioned treesit-install-language-server but I don't have a command for that, assume you meant grammar?

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

emacs I am using was built with tree-sitter, but not tree-sitter-langs, maybe that is the problem?

https://search.nixos.org/packages?channel=22.11&show=emacsPackages.tree-sitter-langs&from=0&size=50&sort=relevance&type=packages&query=tree-sitter-lang

https://github.com/acdoussan/env-setup/blob/emacs-29/files/nix/emacs-override.nix#L22

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

from what I can tell, tree-sitter should provide typescript, as well as a bunch of other grammars

https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/development/tools/parsing/tree-sitter/default.nix#L69

https://github.com/NixOS/nixpkgs/tree/nixos-22.11/pkgs/development/tools/parsing/tree-sitter/grammars

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

I think this is probably the problem, appears ts / a bunch of other languages are missing from treesit-language-source-alist. Is this something I need to set manually?

https://www.reddit.com/r/emacs/comments/zzf9n6/comment/j2cfrc0/?utm_source=share&utm_medium=web2x&context=3

C-h v treesit-language-source-alist

treesit-language-source-alist is a variable defined in treesit.el.gz.

Value
((yaml "https://github.com/ikatyang/tree-sitter-yaml" nil nil nil nil)
 (toml "https://github.com/tree-sitter/tree-sitter-toml" nil nil nil nil)
 (rust "https://github.com/tree-sitter/tree-sitter-rust" nil nil nil nil)
 (ruby "https://github.com/tree-sitter/tree-sitter-ruby" nil nil nil nil)
 (python "https://github.com/tree-sitter/tree-sitter-python" nil nil nil nil)
 (protobuf "https://github.com/mitchellh/tree-sitter-proto" nil nil nil nil)
 (markdown "https://github.com/ikatyang/tree-sitter-markdown" nil nil nil nil)
 (make "https://github.com/alemuller/tree-sitter-make" nil nil nil nil)
 (lua "https://github.com/Azganoth/tree-sitter-lua" nil nil nil nil)
 (latex "https://github.com/latex-lsp/tree-sitter-latex" nil nil nil nil)
 (julia "https://github.com/tree-sitter/tree-sitter-julia" nil nil nil nil)
 (json "https://github.com/tree-sitter/tree-sitter-json" nil nil nil nil)
 (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src" nil nil)
 (java "https://github.com/tree-sitter/tree-sitter-java" nil nil nil nil)
 (html "https://github.com/tree-sitter/tree-sitter-html" nil nil nil nil)
 (go "https://github.com/tree-sitter/tree-sitter-go" nil nil nil nil)
 (elixir "https://github.com/elixir-lang/tree-sitter-elixir" nil nil nil nil)
 (dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile" nil nil nil nil)
 (css "https://github.com/tree-sitter/tree-sitter-css" nil nil nil nil)
 (cpp "https://github.com/tree-sitter/tree-sitter-cpp" nil nil nil nil)
 (commonlisp "https://github.com/theHamsta/tree-sitter-commonlisp" nil nil nil nil)
 (cmake "https://github.com/uyha/tree-sitter-cmake" nil nil nil nil)
 (c-sharp "https://github.com/tree-sitter/tree-sitter-c-sharp" nil nil nil nil)
 (c "https://github.com/tree-sitter/tree-sitter-c" nil nil nil nil)
 (bibtex "https://github.com/latex-lsp/tree-sitter-bibtex" nil nil nil nil)
 (bash "https://github.com/tree-sitter/tree-sitter-bash" nil nil nil nil))

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

C-h v treesit-auto-lang-recipe-alist

treesit-auto-lang-recipe-alist is a variable defined in
treesit-auto.el.

Value
((yaml . #s(treesit-auto-recipe yaml yaml-ts-mode yaml-mode "https://github.com/ikatyang/tree-sitter-yaml" nil nil nil nil))
 (toml . #s(treesit-auto-recipe toml toml-ts-mode
                                (conf-toml-mode toml-mode)
                                "https://github.com/tree-sitter/tree-sitter-toml" nil nil nil nil))
 (rust . #s(treesit-auto-recipe rust rust-ts-mode rust-mode "https://github.com/tree-sitter/tree-sitter-rust" nil nil nil nil))
 (ruby . #s(treesit-auto-recipe ruby ruby-ts-mode ruby-mode "https://github.com/tree-sitter/tree-sitter-ruby" nil nil nil nil))
 (python . #s(treesit-auto-recipe python python-ts-mode python-mode "https://github.com/tree-sitter/tree-sitter-python" nil nil nil nil))
 (protobuf . #s(treesit-auto-recipe protobuf protobuf-ts-mode protobuf-mode "https://github.com/mitchellh/tree-sitter-proto" nil nil nil nil))
 (markdown . #s(treesit-auto-recipe markdown markdown-ts-mode
                                    (poly-markdown-mode markdown-mode)
                                    "https://github.com/ikatyang/tree-sitter-markdown" nil nil nil nil))
 (make . #s(treesit-auto-recipe make makefile-ts-mode makefile-mode "https://github.com/alemuller/tree-sitter-make" nil nil nil nil))
 (lua . #s(treesit-auto-recipe lua lua-ts-mode lua-mode "https://github.com/Azganoth/tree-sitter-lua" nil nil nil nil))
 (latex . #s(treesit-auto-recipe latex latex-ts-mode latex-mode "https://github.com/latex-lsp/tree-sitter-latex" nil nil nil nil))
 (julia . #s(treesit-auto-recipe julia julia-ts-mode julia-mode "https://github.com/tree-sitter/tree-sitter-julia" nil nil nil nil))
 (json . #s(treesit-auto-recipe json json-ts-mode js-json-mode "https://github.com/tree-sitter/tree-sitter-json" nil nil nil nil))
 (javascript . #s(treesit-auto-recipe javascript js-ts-mode
                                      (js-mode javascript-mode js2-mode)
                                      "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src" nil nil))
 (java . #s(treesit-auto-recipe java java-ts-mode java-mode "https://github.com/tree-sitter/tree-sitter-java" nil nil nil nil))
 (html . #s(treesit-auto-recipe html html-ts-mode
                                (mhtml-mode sgml-mode)
                                "https://github.com/tree-sitter/tree-sitter-html" nil nil nil nil))
 (go . #s(treesit-auto-recipe go go-ts-mode go-mode "https://github.com/tree-sitter/tree-sitter-go" nil nil nil nil))
 (elixir . #s(treesit-auto-recipe elixir elixir-ts-mode elixir-mode "https://github.com/elixir-lang/tree-sitter-elixir" nil nil nil nil))
 (dockerfile . #s(treesit-auto-recipe dockerfile dockerfile-ts-mode dockerfile-mode "https://github.com/camdencheek/tree-sitter-dockerfile" nil nil nil nil))
 (css . #s(treesit-auto-recipe css css-ts-mode css-mode "https://github.com/tree-sitter/tree-sitter-css" nil nil nil nil))
 (cpp . #s(treesit-auto-recipe cpp c++-ts-mode c++-mode "https://github.com/tree-sitter/tree-sitter-cpp" nil nil nil nil))
 (commonlisp . #s(treesit-auto-recipe commonlisp commonlisp-ts-mode common-lisp-mode "https://github.com/theHamsta/tree-sitter-commonlisp" nil nil nil nil))
 (cmake . #s(treesit-auto-recipe cmake cmake-ts-mode cmake-mode "https://github.com/uyha/tree-sitter-cmake" nil nil nil nil))
 (c-sharp . #s(treesit-auto-recipe c-sharp csharp-ts-mode csharp-mode "https://github.com/tree-sitter/tree-sitter-c-sharp" nil nil nil nil))
 (c . #s(treesit-auto-recipe c c-ts-mode c-mode "https://github.com/tree-sitter/tree-sitter-c" nil nil nil nil))
 (bibtex . #s(treesit-auto-recipe bibtex bibtex-ts-mode bibtex-mode "https://github.com/latex-lsp/tree-sitter-bibtex" nil nil nil nil))
 (bash . #s(treesit-auto-recipe bash bash-ts-mode sh-mode "https://github.com/tree-sitter/tree-sitter-bash" nil nil nil nil)))

also missing typescript / all of the other langs

from .emacs.d.

seagle0128 avatar seagle0128 commented on May 30, 2024

I think the questions are for the upstream: treesit-auto.

from .emacs.d.

acdoussan avatar acdoussan commented on May 30, 2024

treesit-auto has (sort of) fixed this, think this can be closed, thanks for the help!

In the future is there an easy way to tell if something is a downstream problem rather than with centaur-emacs? I really appreciate this library and don't want to make it a pain for you to maintain with opening issues that are not your problem, but my understanding of emacs is admittedly pretty superficial, thus why I want to use something like centaur-emacs.

Thanks again!

from .emacs.d.

seagle0128 avatar seagle0128 commented on May 30, 2024

I'd happy to help 😄
Before reporting the issue, you can reproduce with emacs -Q and the relevant packages. It may be difficult to users, but please try.

from .emacs.d.

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.