Skip to content
Merged

v0.8 #190

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0f2b68b
update all dependencies to latest versions
selfint Oct 31, 2025
fcd206d
update CHANGELOG.md
selfint Oct 31, 2025
cba25cd
update package version
selfint Oct 31, 2025
1aba616
use node 20 in ci
selfint Oct 31, 2025
ef17459
fix examples test harness
selfint Oct 31, 2025
037ca8f
speed up pr ci
selfint Oct 31, 2025
b359910
try to fix examples ci
selfint Oct 31, 2025
183d067
fix package ci step
selfint Oct 31, 2025
fd8c533
speed up ci
selfint Oct 31, 2025
ae869d9
Update examples [skip ci]
invalid-email-address Oct 31, 2025
f2536a0
fix generate-example-asset script
selfint Oct 31, 2025
f5248d7
Update examples [skip ci]
invalid-email-address Oct 31, 2025
d2a4fe8
update package.json vscode engine version
selfint Oct 31, 2025
7c893a2
update CHANGELOG.md
selfint Nov 1, 2025
8e5f483
fix tree view example
selfint Nov 1, 2025
f7b4ecd
improve type example util
selfint Nov 1, 2025
83c2976
refactor example util
selfint Nov 1, 2025
c397861
update block move rust match arms example
selfint Nov 1, 2025
3fbe991
add apt update to ci
selfint Nov 1, 2025
ba0f891
update CHANGELOG.md
selfint Nov 1, 2025
76af932
speed up ci
selfint Nov 1, 2025
b72a09e
Update examples [skip ci]
invalid-email-address Nov 1, 2025
909de5b
update block mode move rust match arms example
selfint Nov 1, 2025
0ae4f9d
Update examples [skip ci]
invalid-email-address Nov 1, 2025
4632ee5
Fix Block_Mode_-_Move_-_Rust_-_Match_arms
selfint Nov 1, 2025
2ede068
Update examples [skip ci]
invalid-email-address Nov 1, 2025
2cfdb80
Revise README for optional requirements and clarity
selfint Nov 1, 2025
e55977b
Update README.md
selfint Nov 1, 2025
90370b9
Use import instead of require in Installer (#192)
selfint Nov 1, 2025
6399421
update README.md
selfint Nov 1, 2025
3bd5d3b
Use npm to build parsers (#194)
selfint Nov 4, 2025
f302e68
update installer logs
selfint Nov 4, 2025
02bd502
use node-gyp to build parsers for electron runtime
selfint Nov 4, 2025
7d1a5c6
use npm exec instead of npx
selfint Nov 4, 2025
4c7df11
debug tree sitter parser builds
selfint Nov 4, 2025
398b155
add [latex] and [sql] npm packages
selfint Nov 4, 2025
36d7da8
cleanup README and remove tree-sitter-cli from it
selfint Nov 4, 2025
cfcad3b
update 0.8.0 changelog
selfint Nov 4, 2025
513c895
Install tree-sitter on client on activate
selfint Nov 5, 2025
9080c05
remove debug code
selfint Nov 5, 2025
f27453d
speed pr ci
selfint Nov 5, 2025
7ceeb57
fix tree-sitter binary dependency
selfint Nov 5, 2025
7fb1d83
fix tree-sitter binary dependency (retry 2)
selfint Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .eslintrc.js

This file was deleted.

45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": "tsconfig.json",
"tsconfigRootDir": "."
},
"plugins": [
"@typescript-eslint"
],
"root": true,
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_.*"
}
],
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"@typescript-eslint/consistent-type-definitions": [
"error",
"type"
],
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off",
"@typescript-eslint/explicit-function-return-type": "warn",
"no-duplicate-imports": "warn",
"sort-imports": "warn",
"no-trailing-spaces": "warn"
},
"ignorePatterns": [
"webview-ui/**",
".eslintrc.js"
]
}
6 changes: 3 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
Expand Down Expand Up @@ -54,13 +54,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
run: yarn run build:webview
- name: Package extension
run: npx @vscode/vsce package --yarn --githubBranch ${{ github.ref_name }}
run: npx --yes @vscode/vsce package --yarn --githubBranch ${{ github.ref_name }}
- name: Upload extension
uses: actions/upload-artifact@v4
with:
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
Expand Down Expand Up @@ -50,9 +50,17 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install asset generation dependencies
run: sudo apt install -y ffmpeg libnss3 xvfb
run: |
sudo mkdir -p /usr/local/bin
sudo ln -sf /bin/true /usr/local/bin/mandb # no-op to skip man-db triggers
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive \
apt install -y --no-install-recommends \
ffmpeg libnss3 xvfb \
-o Dpkg::Options::="--path-exclude=/usr/share/man/*" \
-o Dpkg::Options::="--path-exclude=/usr/share/doc/*"
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
Expand All @@ -75,21 +83,20 @@ jobs:

package:
name: Package extension
needs: examples
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
run: yarn run build:webview
- name: Package extension
run: npx @vscode/vsce package --yarn --githubBranch ${{ env.BRANCH }}
run: npx --yes @vscode/vsce package --yarn --githubBranch ${{ env.BRANCH }}
- name: Upload extension
uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/update-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Install asset generation dependencies
run: sudo apt install -y ffmpeg libnss3 xvfb
run: |
sudo mkdir -p /usr/local/bin
sudo ln -sf /bin/true /usr/local/bin/mandb # no-op to skip man-db triggers
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive \
apt install -y --no-install-recommends \
ffmpeg libnss3 xvfb \
-o Dpkg::Options::="--path-exclude=/usr/share/man/*" \
-o Dpkg::Options::="--path-exclude=/usr/share/doc/*"
- name: Install extension dependencies
run: yarn run install:all
- name: Build webview
Expand Down
13 changes: 10 additions & 3 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
!LICENSE
!README.md
!assets/extension-logo.png
!node_modules/tree-sitter
!out/extension.js
!webview-ui/public

# keep only non-compiled dependency files
!node_modules/node-gyp-build
!node_modules/node-addon-api
!out/extension.js
!webview-ui/public
!node_modules/tree-sitter/src
!node_modules/tree-sitter/vendor
!node_modules/tree-sitter/binding.gyp
!node_modules/tree-sitter/index.js
!node_modules/tree-sitter/package.json
!node_modules/tree-sitter/LICENSE
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
# Changelog

# [Unreleased]
# 0.8.0

## Added

- Multi-cursor support in Block Mode, thanks [@CB2Moon](https://github.com/selfint/code-blocks/pull/188)!

![example](./assets/examples/Block_Mode_-_Move_-_Rust_-_Match_arms.gif)

- `toml` and `xml` support, thanks [@sanarise](https://github.com/selfint/code-blocks/pull/186)!

- `sql` and `latex` support using [@derekstride/tree-sitter-sql](https://github.com/DerekStride/tree-sitter-sql) and [@derekstride/tree-sitter-sql](https://github.com/latex-lsp/tree-sitter-latex).

- ESM-based parser loading for parsers like CSS ([#191](https://github.com/selfint/code-blocks/issues/191)).

- 'Remove' option to notification when parser fails to load ([#180](https://github.com/selfint/code-blocks/issues/180)).

- More languages are now tested in advance: TOML, XML, CSS, Zig, Swift, SQL, LaTeX.

## Fixed

- Add 'Remove' option to notification if local parser installation fails to load.
- Parser build method ([[#193](https://github.com/selfint/code-blocks/issues/193)]), now uses `node-gyp` instead of `tree-sitter-cli`.

## Deprecated

- Support for `node` v18, it might still work, but the extension now requires `node` v20+.

## Removed

- `codeBlocks.treeSitterCliPath` configuration: The Extension now only requires `npm`.

# 0.7.0

Expand Down
47 changes: 15 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://github.com/selfint/code-blocks">
<img src="./assets/extension-logo.png"alt="logo" width='128'/>
<img src="./assets/extension-logo.png" alt="logo" width='128'/>
</a>
</p>

Expand All @@ -24,14 +24,13 @@ Supercharge your editor with syntactically aware code navigation and manipulatio

### Block mode

Syntactically aware code selection (e.g. select scope), navigation (e.g. goto next function)
and manipulation (e.g. re-order function parameters), right inside your editor.
Syntactically aware code selection (e.g. select scope), navigation (e.g. goto next function) and manipulation (e.g. re-order function parameters), right inside your editor.

![rust_parameters_example](./assets/examples/Block_Mode_-_Move_-_Rust_-_Parameters.gif)

### Code Blocks Editor

Birds eye view over all your code blocks, with point and click refactoring.
Bird's-eye view over all your code blocks, with point and click refactoring.

![svelte-1](./assets/editor/Code%20Blocks%20Demo%20-%20Editor%20-%20svelte%201.gif)

Expand All @@ -43,15 +42,7 @@ View your code's syntax tree directly

## Requirements

- `node` / `npm`: Used to download tree-sitter language parsers. Can be installed from [here](https://nodejs.org/en/download).

- **OPTIONAL:** `tree-sitter`: Used to for tree-sitter language parsers that need to be locally built.

After installing `npm`, can be installed by running:
`npm i -g tree-sitter-cli`.

If you don't want to install `tree-sitter`, there's a good chance you don't
need it. Try the extension without it, it will notify you if it's required.
- `npm`: Used to download and build tree-sitter language parsers. Can be installed from [here](https://nodejs.org/en/download). Must be in `PATH`.

### Note

Expand Down Expand Up @@ -101,30 +92,24 @@ These are the default key bindings, they are only active when "block mode" is ac

### Global

- `codeBlocks.treeSitterCliPath`: Path to the `tree-sitter` cli command. Defaults to `tree-sitter` (assumes command is in PATH).
- `codeBlocks.colors.enabled`: Whether Block Mode should color selections or not. Defaults to `false`.
- `codeBlocks.colors.sibling`: CSS string for sibling selection background color. Defaults to `var(--vscode-editor-selectionHighlightBackground)`.
- `codeBlocks.colors.parent`: CSS string for parent selection background color. Defaults to `var(--vscode-editor-linkedEditingBackground)`.
- `codeBlocks.ignoredLanguageIds`: Array of VScode [languageId](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers)s not to install/load parsers for.
- `codeBlocks.colors.enabled`: Whether Block Mode should color selections or not. Defaults to `false`.
- `codeBlocks.colors.sibling`: CSS string for sibling selection background color. Defaults to `var(--vscode-editor-selectionHighlightBackground)`.
- `codeBlocks.colors.parent`: CSS string for parent selection background color. Defaults to `var(--vscode-editor-linkedEditingBackground)`.
- `codeBlocks.ignoredLanguageIds`: Array of VScode [languageId](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers)s not to install/load parsers for.

### Language specific (advanced)

These configurations are set at the [languageId](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers) level.

Most languages should just work™, if you find a language that requires manual configuration please [create an issue](https://github.com/selfint/code-blocks/issues).
Or [create a pull request](https://github.com/selfint/code-blocks/pulls) with your configuration added to the `configurationDefaults` section of the `package.json` file.
Most languages should just work™, if you find a language that requires manual configuration please [create an issue](https://github.com/selfint/code-blocks/issues). Or [create a pull request](https://github.com/selfint/code-blocks/pulls) with your configuration added to the `configurationDefaults` section of the `package.json` file.

- `codeBlocks.npmPackageName`: [NPM](https://www.npmjs.com/) package name of the `tree-sitter` parser to use for the
language. Defaults to `tree-sitter-<languageId>`, change if the package name doesn't match the languageId.
- `codeBlocks.npmPackageName`: [NPM](https://www.npmjs.com/) package name of the `tree-sitter` parser to use for the language. Defaults to `tree-sitter-<languageId>`, change if the package name doesn't match the languageId.

- `codeBlocks.parserName`: Filename of the WASM parser built by the `tree-sitter build --wasm` command, without the
`.wasm` extension. Defaults to `tree-sitter-<languageId>`, change if the parser filename doesn't match the languageId.
- `codeBlocks.parserName`: Name to save parser as (defaults to `tree-sitter-<languageID>`), change if the package name doesn't match the languageId (e.g., `tree-sitter-typescript` for `[typescriptreact]` languageId).

- `codeBlocks.subdirectory`: Directory inside the NPM package containing the `tree-sitter` grammar. Defaults to the
root directory of the package, change if the grammar isn't there.
- `codeBlocks.subdirectory`: Directory inside the NPM package containing the `tree-sitter` grammar. Defaults to the root directory of the package, change if the grammar isn't there.

- `codeBlocks.queries`: Tree-sitter [queries](https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax)
to generate blocks, must contain at least one `@capture`. The name of the capture doesn't matter, the entire match will be a block.
- `codeBlocks.queries`: Tree-sitter [queries](https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax) to generate blocks, must contain at least one `@capture`. The name of the capture doesn't matter, the entire match will be a block.

Required by [Code Blocks Editor](#code-blocks-editor).

Expand All @@ -136,8 +121,6 @@ Language ID: `typescriptreact`

NPM package name: [tree-sitter-typescript](https://www.npmjs.com/package/tree-sitter-typescript)

WASM parser name: `tree-sitter-ts.wasm`

Desired blocks: JSX blocks, and documentation comments should be merged with documentees.

```jsonc
Expand Down Expand Up @@ -166,11 +149,11 @@ Desired blocks: JSX blocks, and documentation comments should be merged with doc

### Custom editors

- Code Blocks Editor (viewType `codeBlocks.editor`): UI for moving code blocks inside a file. Useful when refactoring large blocks over long distances.
- Code Blocks Editor (viewType `codeBlocks.editor`): UI for moving code blocks inside a file. Useful when refactoring large blocks over long distances.

## Known Issues

- Out of bounds memory access ([#154](https://github.com/selfint/code-blocks/issues/154)): For now, reloading the editor fixes this.
No known issues as of November 1, 2025.

## License

Expand Down
Binary file modified assets/examples/Block_Mode_-_Move_-_Rust_-_Functions.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/examples/Block_Mode_-_Move_-_Rust_-_Match_arms.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/examples/Block_Mode_-_Move_-_Rust_-_Parameters.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/examples/Block_Mode_-_Select_-_Rust.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/examples/Block_Mode_-_Select_-_TypeScript.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/examples/Tree_Viewer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading