Slow rebuild time for dev extensions with grammar #43685
boris-schwarz
started this conversation in
Extensions and Themes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Not sure if worth an issue or a discussion, but as far as I can tell some kind of cache for compiled grammars is needed when developing a local dev extension.
When creating an extension that uses a tree-sitter repository, installing or rebuilding the extension also compiles the provided grammars in
extension.tomlevery time. For my currently used grammar, this takes about 2 minutes every time:The function
compile_grammar()inzed/crates/extension/src/extension_builder.rsalways compiles all grammars in the extension manifest, I cannot find any mechanic for caching, for instance the structGrammarManifestEntryonly allowsrepository,rev(aliascommit) andpath, but no other configuration. Also the flagreleaseinCompileExtensionOptionsdoes not play a role.This is most likely intentional, so no pre-compiled code can be sneaked in, however during local development mode it would make sense to be able to skip the compilation of the grammars.
I could imagine a workflow like this:
If
install_dev_extension()orrebuild_dev_extension()are called,compile_extension()additionally checks ifgrammars/my_grammar.wasmexists, if it does the clang compilation for that grammar will be skipped. It would be then in the responsibility of the developer to delete thegrammars/my_grammar/andgrammars/my_grammar.wasm, as it is currently also the case if the git commit hash is being changed.What do you think? Did I miss something or is anybody also having long rebuild times?
Cheers, Boris
Beta Was this translation helpful? Give feedback.
All reactions