Code BlocksMove your code blocks around! This extension allows you to move your code as blocks, in any language*. Rust (technically just Installation
That's it! The next time you open a file in the same language, everything will already be setup. If you open a file in a new language, the appropriate tree sitter grammar will be downloaded and compiled again. Installation demoExamplesTypeScript + JSXSvelteRustCode blocks moving function attributes and documentationCode blocks not moving blocks between scopesPython*Supported languagesTo support a language, tree-sitter querys are required to resolve blocks. This involves some manual labour for each language, but not much. Also, to use a language, a tree-sitter grammar is required. There are many grammars already written, but to use them they need to be compiled. The extension will automatically download and compile the grammar for you, but it needs to know some metadata about each grammar. For now, these are the default configured languages:
Next up:
Adding a languageTo add support for a language yourself, you'll need to:
Here is an example of the configuration for Python:
For figuring out how to write the queries, use the Tree-sitter playground. |