DerekStride / tree-sitter-sql

SQL grammar for tree-sitter
http://derek.stride.host/tree-sitter-sql/
MIT License
147 stars 47 forks source link

Scanner.c is missing on npm, therefore preventing the package installation #231

Closed JonathanxD closed 8 months ago

JonathanxD commented 8 months ago

The scanner.c file is missing on the published npm package. This is causing the npm install to fail during the node-gyp rebuild step.

Steps to reproduce

$ mkdir tree-sitter-sql
$ cd tree-sitter-sql
$ npm pack @derekstride/tree-sitter-sql@0.1.1
$ tar --strip-components=1 -xvf derekstride-tree-sitter-sql-0.1.1.tgz package/
$ npm install

The compilation step will fail with the following error:

make: *** No rule to make target 'Release/obj.target/tree_sitter_sql_binding/src/scanner.o', needed by 'Release/obj.target/tree_sitter_sql_binding.node'.  Stop.

But if you download the scanner.c manually, it'll work:

$ mkdir -p src/
$ curl -Lo src/scanner.c 'https://derek.stride.host/tree-sitter-sql/src/scanner.c'
$ npm install

I'm not well versed on the npm publish behavior, but I think this is being caused by having /src/ defined on .gitignore.

steve-marmalade commented 8 months ago

Could this be the cause of the following error I'm getting when opening a .sql file?

Error executing lua callback: Failed to load parser for language 'sql': uv_dlopen: /home/user/.local/share/nvim/site/pack/packer/start
/nvim-treesitter/parser/sql.so: undefined symbol: tree_sitter_sql_external_scanner_create
DerekStride commented 8 months ago

v0.2.0 should have scanner.c included.

Could this be the cause of the following error I'm getting when opening a .sql file?

I'm doubtful, neovim requests scanner.c by default:

https://github.com/nvim-treesitter/nvim-treesitter/blob/000f71842bf08840df1e70004b17507fa92b2fb7/lua/nvim-treesitter/parsers.lua#L1742

JonathanxD commented 8 months ago

v0.2.0 should have scanner.c included.

Could this be the cause of the following error I'm getting when opening a .sql file?

I'm doubtful, neovim requests scanner.c by default:

nvim-treesitter/nvim-treesitter@000f718/lua/nvim-treesitter/parsers.lua#L1742

Thank you!