Comments (16)
You can check the code to see exactly how we build it. This needs to be fixed upstream; if you rely on the parser, just lock your nvim-treesitter version until then.
from nvim-treesitter.
I think they are functionally equivalent. You can test tree-sitter build -o php_only.so
to see how that behaves. (Nvim-treesitter will switch to that in 1.0 anyway.)
from nvim-treesitter.
I don't know if it will help, I found that error occurs on injections (and when compiled with -Os
of course).
reproducer:
<?php
$query = <<<SQL
select * from users;
SQL;
from nvim-treesitter.
@przepompownia Renaming php_only.so forced the plugin to download it again, but the error was still there. Then I updated the plugin via lazy (:Lazy
then U
), and it seems to be working fine now! Thanks.
from nvim-treesitter.
Then you should report that with that parser; there's nothing we can do about it here.
from nvim-treesitter.
Not completely. Maybe it would be better to revert 4e21361 while the parser crashes on tree-sitter/tree-sitter-php@58054be.
On the tree-sitter-php side I still haven't investigated how to get the same parser binary as created with nvim-treesitter. It differs from the build by make -C php_only
there. That's (at least) why I can't report a bug there for now.
from nvim-treesitter.
Yet one note here (on Linux with gcc).
- nvim-treesitter builds the parser with
cc -o parser.so -I./src src/parser.c src/scanner.c -Os -shared -fPIC`
- make's output on the project shows another way of building the binary that doesn't crash:
cc -Isrc -std=c11 -fPIC -c -o src/parser.o src/parser.c
cc -Isrc -std=c11 -fPIC -c -o src/scanner.o src/scanner.c
ar rv libtree-sitter-php_only.a src/parser.o src/scanner.o
ar: creating libtree-sitter-php_only.a
a - src/parser.o
a - src/scanner.o
cc -shared -Wl,-soname,libtree-sitter-php_only.so.0 src/parser.o src/scanner.o -o libtree-sitter-php_only.so
- The CLI seems to build its own parser binary (stored in ~/.cache folder) in an unknown way, which makes reproduction difficult (tree-sitter/tree-sitter#3336).
Should we assume that the way used by nvim-treesitter is always correct?
from nvim-treesitter.
I think they are functionally equivalent.
For some reason, 1. produces crashing binary unlike 2.
tree-sitter build -o php_only.so
I'm confused: currently I have CLI written in Rust, from Debian package (0.20.8-5). It does not have build
subcommand. I tried tree-sitter generate --build
. It resulted with ~/.cache/tree-sitter/lib/php_only.so
but without details about compiling.
from nvim-treesitter.
Yeah, that's too old. Current is 0.22.5 (soon to be 6), with massive changes. That's what we target, exclusively.
from nvim-treesitter.
Indeed, in the new version build
exists and builds the correct binary.
from nvim-treesitter.
I faced simlar issue. when trying to open some php files I get munmap_chunk(): invalid pointer
. after bisecting and looking at tree-sitter-php
's makefile and nvim-treesitter
's source code, I found out that if we don't include compiler flag -Os
(optimize for size), then error would not occur.
from nvim-treesitter.
Please report that upstream; a valid compiler flag should not lead to a segfault. (Also, try a newer gcc, or clang.)
from nvim-treesitter.
Fixed in tree-sitter/tree-sitter-php@27afeb0
from nvim-treesitter.
Thank you all for your involvement. After fixing the parser built by nvim-treesitter works for me as expected.
from nvim-treesitter.
Thanks all for the work! Any pointers (no pun intended) as to how to manually update the php parser now that it’s fixed? :TSUpdate
says all parsers are up-to-date but the crash is still happening so I’m guessing the fix hasn’t made it yet to nvim-treesitter
. (real neovim noob here)
from nvim-treesitter.
@sylbru first check paths to generated php (php_only) binaries on :che vim.treesitter
view (modification times). Try uninstalling and installing the parser again. I assume that you have nvim-treesitter up to date, otherwise you can still get outdated parser library.
from nvim-treesitter.
Related Issues (20)
- Invalid Node Type, Typescript HOT 2
- Nvim doc text disappears HOT 4
- minus a number without a space results in no highlighting for the number HOT 3
- after updating nvim-treesitter, .R files yield nvim-treesitter lua errors HOT 6
- TS highlight not auto-enabling for Ruby files (highlight module is enabled & configured) HOT 3
- Astro highlighting not working HOT 2
- Performance Issues with Treesitter Plugin for .pdb Files in Neovim HOT 10
- Max diagnostics per-line example crashes when removing lines above errors HOT 2
- Indent level off by 1 for javascript/typescript
- Nix language injection breaks commentstring HOT 5
- Markdown heading continues to next line HOT 10
- Wrong indent in tsx file HOT 9
- Python indentation not working properly HOT 2
- bash regex editing hangs neovim HOT 1
- Selecting inside / within a node HOT 2
- nvim +PlugUpdate does not update treesitter (results in errors) HOT 4
- C23 auto keyword highlighted as keyword.modifier not as type HOT 4
- Python: Current line dedented while typing slice (`:`) HOT 1
- TS Parser PHP errors with Invalid node type "anonymous_function_creation_expression" HOT 5
- Error in php files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-treesitter.