Closed olvyko closed 5 years ago
Would you please download the latest version (0.1.4), open the dev tools in VSCode, and show me what appears in your console?
Yeah, had some errors and warnings
Hmmm, it seems I am not correctly building for Windows, so right now it only works on Mac. There's some information here and here.
Alternatively I could switch to tree-sitter WASM: https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web
Getting issues on Linux as well
workbench.main.js:238 [Extension Host] Here is the error stack: Error: /home/mmstick/.vscode/extensions/georgewfraser.vscode-tree-sitter-0.1.4/node_modules/tree-sitter/build/Release/tree_sitter_runtime_binding.node: invalid ELF header
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Function.define._installInterceptor.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:480:42)
at Function.t._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:743:482)
at Function.t.getExtensionPathIndex.then.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:669:176)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/mmstick/.vscode/extensions/georgewfraser.vscode-tree-sitter-0.1.4/node_modules/tree-sitter/index.js:3:13)
at Object.<anonymous> (/home/mmstick/.vscode/extensions/georgewfraser.vscode-tree-sitter-0.1.4/node_modules/tree-sitter/index.js:497:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Function.define._installInterceptor.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:480:42)
at Function.t._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:743:482)
at Function.t.getExtensionPathIndex.then.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:669:176)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/home/mmstick/.vscode/extensions/georgewfraser.vscode-tree-sitter-0.1.4/out/extension.js:4:16)
at Object.<anonymous> (/home/mmstick/.vscode/extensions/georgewfraser.vscode-tree-sitter-0.1.4/out/extension.js:178:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Function.define._installInterceptor.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:480:42)
at Function.t._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:743:482)
at Function.t.getExtensionPathIndex.then.i._load (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:669:176)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Function.i [as __$__nodeRequire] (/usr/share/code/resources/app/out/vs/loader.js:31:542)
at /usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:730:450
at k._doActivateExtension (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:730:558)
at k._activateExtension (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:729:404)
at k.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:726:330)
at Generator.next (<anonymous>)
at n (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:13:388)
at new Promise (<anonymous>)
at n (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:13:165)
at Object.actualActivateExtension (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:726:32)
at p._activateExtension (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:468:561)
at define._activateExtensions.r.length.Promise.all.o.map.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:468:245)
at Array.map (<anonymous>)
at p._activateExtensions (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:468:233)
at p.activateByEvent (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:466:126)
at k._activateByEvent (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:728:69)
at define.$activateByEvent._readyToRunExtensions.wait.then.t (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:736:221)
I think I have the build working correctly for windows and linux, but I can't distribute 3 different builds of the extension until https://github.com/microsoft/vscode/issues/23251 is finished (which will apparently be June). In the meantime, you can download the appropriate .vsix file from here:
https://github.com/georgewfraser/vscode-tree-sitter/releases/tag/latest
and install manually:
Thanks. That seems to work. Sadly, still not as good as the syntax highlighting in Atom, though it's a lot better than before.
@mmstick This is just the first version! It's easy to tweak the colorization rules, and contributions are encouraged: https://github.com/georgewfraser/vscode-tree-sitter#fixing-colorization-of-an-existing-language
I think Tree Sitter WASM would be ideal. I was going to open up a PR but I can't get the extension to run locally due to build issues.
I'm on a mac running High Sierra, and the extension works without manually installing .vsix
, but building it locally gets the following error
'/Users/jeffhykin/Nextcloud/Programming/tree-sitter/node_modules/tree-sitter/build/Release/tree_sitter_runtime_binding.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 57. This version of Node.js requires NODE_MODULE_VERSION 64. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`)..
I've rebuild and reinstalled the tree-sitter package, nuked node_modules/
and reinstalled everything with a clean cache and tried electron-rebuild
but no luck.
@georgewfraser this approach might be helpful? https://github.com/elm-tooling/elm-language-server/blob/master/server/src/util/rebuilder.ts
This has been fixed by switching to WASM. Thanks @jeff-hykin for showing how it's done!
When I installed this extension, almost all colors are no longer displayed. Tested with C++ and Rust code.
Before:![tree-sitter-off](https://user-images.githubusercontent.com/44478988/57990662-03017680-7aa9-11e9-8d13-c35045b71d75.png)
After:![tree-sitter-on](https://user-images.githubusercontent.com/44478988/57990666-0ac11b00-7aa9-11e9-9482-380c192ce063.png)