Giter VIP home page Giter VIP logo

Comments (9)

theHamsta avatar theHamsta commented on May 27, 2024 2

jdummy must be the name of your grammar in grammar.js. Only then tree_sitter_jdummy will end up in the compiled shared object. You can check the symbols in the parser binary with nm

from nvim-treesitter.

kyazdani42 avatar kyazdani42 commented on May 27, 2024 1

set ft=jdummy ?

from nvim-treesitter.

kyazdani42 avatar kyazdani42 commented on May 27, 2024 1

yes it is. set ft=jdummy will set the filetype of your buffer to jdummy (:help filetype)

from nvim-treesitter.

theHamsta avatar theHamsta commented on May 27, 2024

Calling this

    require "nvim-treesitter.parsers".get_parser_configs().clojure = {
        install_info = {
            url = "https://github.com/oakmac/tree-sitter-clojure",
            files = {"src/parser.c"}
        }
    }

before setup works for me.

from nvim-treesitter.

vigoux avatar vigoux commented on May 27, 2024

That's nice, I also added some things too, pr to come.

from nvim-treesitter.

rabieifk avatar rabieifk commented on May 27, 2024

I'm trying to add my own parser to nvim-tree-sitter.
:TSPlaygroundToggle does not show anything.

What I did:

  1. Built a custom parser, grammar.js and highlights.scm.
    No errors running the following snippet,
tree-sitter generate
tree-sitter test
  1. Added the following snippet to init.vim
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.jdummy = {
  install_info = {
    url = <path_to_repo>,
    files = { "src/parser.c" },
    branch= 'main'
  },
  filetype = "jdummy", -- if filetype does not agrees with parser name
}
  1. Installed the parsers without any errors,
    :TSInstall jdummy
    The jdummy.so is created in the /home/farzaneh/.local/share/nvim/plugged/nvim-treesitter/parser path
  2. nvim test.jdummy
  3. :TSPlaygroundToggle does not show anything for me.

Am I missing something?

from nvim-treesitter.

rabieifk avatar rabieifk commented on May 27, 2024

Is that a command?
Where should I run set ft=jdummy ?

from nvim-treesitter.

rabieifk avatar rabieifk commented on May 27, 2024

I took these steps:
nvim test.jdummy
:set filetype=jdummy
:TSPlaygroundToggle

an error occurred:

Error executing vim.schedule lua callback: Failed to load parser: uv_dlsym: /home/farzaneh/.local/share/nvim/plugged/nvim-treesitter/parser/jdummy.so: undefined symbol: tree_sitter_jdummy
stack traceback:
        [C]: in function '_ts_add_language'
        ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:33: in function 'require_language'
        /usr/local/share/nvim/runtime/lua/vim/treesitter.lua:38: in function '_create_parser'
        /usr/local/share/nvim/runtime/lua/vim/treesitter.lua:93: in function 'get_parser'
        ...d/playground/lua/nvim-treesitter-playground/internal.lua:50: in function 'get_node_at_cursor'
        ...d/playground/lua/nvim-treesitter-playground/internal.lua:413: in function 'fn'
        ...gged/playground/lua/nvim-treesitter-playground/utils.lua:23: in function 'cb'
        vim.lua:291: in function <vim.lua:291>

Do I have to set anything else?

from nvim-treesitter.

rabieifk avatar rabieifk commented on May 27, 2024

Although the grammar name in grammar.js is jdummy,
after running nm jdummy.so, I see no tree_sitter_jdummy.
What am I missing?

...
0000000000004020 d __TMC_END__
00000000000017f9 T tree_sitter_json
0000000000002790 r ts_alias_sequences
00000000000027a0 r ts_field_map_entries
...

from nvim-treesitter.

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.