jeff-hykin / experimental-tree-sitter

💾 The hub for getting a VS Code Tree Sitter working
MIT License
18 stars 0 forks source link

Cross platform support #1

Closed jeff-hykin closed 5 years ago

jeff-hykin commented 5 years ago

Use tree-sitter wasm to get cross platform support. (Done)

I'm mostly just making this issue to let you guys know about this. @EvgeniyPeshkov @georgewfraser Feel free to pull this into your own repo's its not super complex, I only made my own so that I could test and make changes easier. Everything in this repo is based on @EvgeniyPeshkov 's repo.

georgewfraser commented 5 years ago

Thanks for showing how to do this! I've updated https://github.com/georgewfraser/vscode-tree-sitter to use WASM so it supports all platforms now. I did some JS profiling and verified it has similar performance.

EvgeniyPeshkov commented 5 years ago

Hello @jeff-hykin , Thank you so much for your contribution. WASM solution works perfectly. I've embedded it into the extension, now it works on all platforms.

I would like to share with you my workaround, that I've just finished. Maybe it will be helpful somewhere else. It utilizes npmi. The idea was to publish version, pre-compiled for Windows, where it's hard to install build tools. And let extension recompile native modules on other OSes, where it's very likely, that g++ is already installed.

Your solution is waaay better. Thank you very much again.

razzeee commented 5 years ago

One thing I can't grasp about this, is that you guys don't seem to need to copy the wasm files to the out folder? I needed to do that to make it work, but i'm building a language server, so it might be rooted in that. https://github.com/elm-tooling/elm-language-server/commit/f6f1966832448ed4a1dc64245e516f04901cef9a#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R37

The other problem at the moment is that descendantsOfType isn't implemented for wasm. Really surprised me, as I would have thought that your addons would use it this too. https://github.com/tree-sitter/tree-sitter/issues/349#issuecomment-498067586

jeff-hykin commented 5 years ago

That's a shame, I didn't know wasm was missing support for anything. To be honest though I don't know what the descendantsOfType is.

As for the /out folder, I think you can access the outside files, I think the path just needs to be relative from the /out folder. If it says it doesn't exist I'd try printing out the pwd or cwd to see if its a pathing issue.