Closed piotrkwiecinski closed 1 year ago
I haven't tried dynamically loading treesitter grammars so I'm not familiar with what Emacs is trying to do under the hood. Might you need to add ~/work/php-ts-mode/php-ts-mode/tree-sitter/
to $LD_LIBRARY_PATH
?
@purcell I've tried to change the path, used treesit-additional-load-path, I tried to put grammar directly and nothing works.
I tried to run gdb
in the local container but it doesn't work.
I have downloaded nix as a VM image and will try to debug it this way. Not sure if it's correct approach. Should I use ubuntu and have nix package manager installed on top of it to simulate what happens in the pipeline?
Should I use ubuntu and have nix package manager installed on top of it to simulate what happens in the pipeline?
Yes, Nix on your machine is fine, no NixOS VM necessary. I don't have much advice on how to debug this, sorry. Note that in general, mixing non-Nix-built .so files with binaries that come with Nix is likely to result in mismatches — it could well be the case that the library is found but can't be loaded. Perhaps the .so links against the tree-sitter shared library, which is probably not visible on the load path within the Emacs process.
I got it working with the version from https://github.com/alexmurray/emacs-snap/tree/emacs-29 . I'll try to recreate the issue locally with nix package manager as I would prefer to this repo for CI.
FYI, Nixpkgs on the latest master now contains support for adding tree-sitter grammars without rebuilding the entire Emacs (see https://github.com/NixOS/nixpkgs/pull/230751). You could use the following shell.nix
(proof-of-concept) to install Emacs with the PHP grammar:
let
emacsCI = (pkgs.emacs.pkgs.overrideScope'
(_: _: {
emacs = emacs-ci.emacs-snapshot.overrideAttrs (_: {
treeSitter = true;
});
}))
.withPackages (epkgs: [
(epkgs.treesit-grammars.with-grammars (grammars: [grammars.tree-sitter-php]))
]);
in
pkgs.mkShell {
buildInputs = [
emacsCI
];
}
This doesn't work right now due to an integration issue with withPackages
wrapper, but I am working on the issue in #170. You also have to update nixpkgs used to build Emacs (niv update nixpkgs
).
I have created https://github.com/emacs-php/php-ts-mode/pull/20 as an example of custom Emacs build with tree-sitter grammars. It works locally, but CI seems to fail without binary cache (operation cancelled).
@purcell and @akirak thank you very much for help. I'm going to close this issue.
Great. Thanks @akirak 🙏
Also thanks to @DamienCassou who has invented the mechanism of treesit-grammars
. It's a great idea.
Hi. First of all I would like to thank you for all the time you put into open source overall.
I have an issue with setting up a CI pipeline for emacs with
treesitter
forphp-ts-mode
.I have tried multiple ways of installing grammar itself and nothing works.
The same script works for me with my local build of emacs 29 but doesn't seem to work as expected in the pipeline.
I have a minimal example to reproduce an issue:
It generates:
You can see it here in
Run tests
https://github.com/piotrkwiecinski/php-ts-mode/actions/runs/5099871411/jobs/9167833683I have installed https://github.com/nektos/act to debug GH action locally and I'm able to reproduce an issue in the local container that I can access.
I tried running gdb on the container but there is no symbol table. I assume I would have to get a nix VM to have a better control.
Any pointers were to go from here? Is there a way to add debug symbols on top of what's currently compiled for CI containers?
Edit: I tested
elixir-ts-mode
withact
locally and it runs correctly and I was their CI work as expected.