Skip to content

Commit 7ca4fb4

Browse files
committed
feat: RIIP
1 parent 2ce2863 commit 7ca4fb4

28 files changed

Lines changed: 3217 additions & 481 deletions

.github/workflows/publish_to_marketplace.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ jobs:
2525
- name: Install dependencies
2626
run: npm ci
2727

28+
- name: Add aarch64 target
29+
run: rustup target add aarch64-unknown-linux-gnu
30+
31+
- name: Install aarch64 gcc
32+
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
33+
34+
- name: Build Native Rust Backend (x64)
35+
run: |
36+
cd rust-core
37+
npm ci || true
38+
npx napi build --platform --target x86_64-unknown-linux-gnu --output-dir ../native-bindings
39+
40+
- name: Build Native Rust Backend (arm64)
41+
run: |
42+
cd rust-core
43+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc npx napi build --platform --target aarch64-unknown-linux-gnu --output-dir ../native-bindings
44+
2845
- name: Install vsce
2946
run: npm install -g @vscode/vsce
3047

@@ -48,6 +65,7 @@ jobs:
4865
# VSCE_PAT 是你需要自己设置的 Personal Access Token
4966
VSCE_PAT: ${{ secrets.VSCE_PAT }}
5067

68+
# 发布到 Open VSX Registry
5169
- name: Install ovsx
5270
run: npm install -g ovsx
5371

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ out
22
dist
33
node_modules
44
.vscode-test/
5-
*.vsix
5+
*.vsix
6+
**/target

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
out/**
44
node_modules/**
55
src/**
6+
rust-core/**
67
.gitignore
78
.yarnrc
89
esbuild.js

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Change Log
22

3-
All notable changes to the "trash4wsl-in-vscode" extension will be documented in this file.
3+
## [2.0.0] - 最新
4+
### Added
5+
- 🚀 **全新升级为原生基于 Rust (NAPI-rs) 引擎底层架构**。零依赖、完全免安装,开箱即用。彻底抛弃了对环境中原生 `trash-cli` python 包的强依赖。
6+
- **优势**:跨环境免依赖(内置二进制)、绝对安全无 Shell 调用、极致性能、能基于文件原路径(Original Parent Path)安全隔离多工作区操作。
47

5-
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6-
7-
## [Unreleased]
8+
### Removed
9+
- 重构了底层逻辑,彻底删除了原本借助 Node.js `exec` 派生子进程和解析终端字符带来的命令注入安全隐患和字符截断 Bug。
810

11+
## [1.1.4] - 历史
912
- Initial release

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<pre align="center"> 简体中文 | <a href="https://github.com/2bitbit/trash4wsl-in-vscode/blob/main/docs/README_en.md">English</a></pre>
44
在VSCode WSL(或其他 remote 连接)中,再也不用担心永久误删文件无法后悔,现在有了迷人的回收站(基于 trash-cli 实现)。
55

6-
6+
在VSCode WSL(或其他 remote 连接)中,再也不用担心误删文件造成的不可逆损失。现在有了一个迷人且极速安全的**原生回收站**(基于底层 Rust Native API 高性能重写,免依赖)。
77

88
<img src="./trash4wsl-demo.gif" alt="demo" width="500" height="auto">
99

@@ -13,20 +13,23 @@
1313
- 支持 WSL、其他remote连接
1414
- 支持快捷键(默认是`delete`删除选中文件,`ctrl+shift+delete`打开回收站面板)
1515
- 简洁的 GUI
16-
16+
- 🚀 **纯原生极速实现**:底层引擎通过 `NAPI-RS` + Rust `trash` 构建,无缝衔接系统底层,极限提升响应速度。
17+
- 📦 **零前置依赖配置**:摆脱由于外部 `trash-cli` 库未安装造成的不能用,真正实现“安装即用”。
18+
- 🎨 **精美的系统级视图面板**:抛弃简陋的弹窗,内置专属大体量沉浸式历史视窗(支持文件分类展示、一键隔离恢复、危险级全部清空)。
19+
- 🛡️ **严格的安全拦截保护**:全原生参数传递,免疫所有的系统级 Shell 执行注入。
20+
- 支持各种基于 WSL 的操作系统以及遵循 FreeDesktop XDG 的各大远程发行版。
21+
- 顺手的键盘绑定(默认选中时按 `delete` 下发垃圾桶,`ctrl+shift+delete` 打开大屏管理面板)。
1722
## 如何使用
18-
1. 在目标环境终端 `apt install trash-cli` 安装 trash-cli
19-
2. 在 VSCode Marketplace 搜索 `trash4WSL-in-vscode` 安装此插件到工作区
20-
3. 选中文件,右键选择 `trash-put (via trash-cli)` 或使用快捷键 `delete` 删除选中文件
21-
4. `ctrl+shift+p` 或使用快捷键`ctrl+shift+delete`打开回收站面板进行相关操作
22-
23-
>温馨提示:默认回收站目录在 `~/.local/share/Trash/files`下。
23+
1. 直接在 VSCode Marketplace 搜索 `trash4WSL-in-vscode` 并安装插件(**不再需要在内部自装任何环境依赖**)。
24+
2. 在左侧资源管理器中选中你想清理的文件(支持多选),右键选择 `丢入回收站 (Trash)`,或者直接施放快捷键 `delete` 即可删除。
25+
3. `ctrl+shift+p` 执行命令或使用快捷键 `ctrl+shift+delete`,将在主编辑区打开宏伟的「工作区回收站」详情面板,进行相关后悔药操作。
2426

25-
## 依赖
26-
- trash-cli
27-
- VSCode
27+
>温馨提示:其底层标准严格遵守 FreeDesktop Trash 规范体系,所以你在插件内删除的数据、都会无缝与系统桌面默认回收站生态共存(存放路径通常为:`~/.local/share/Trash/`)。
2828
29+
## 环境
30+
- 支持新版 VSCode
31+
- Linux (x64 / arm64)
2932

30-
如果这个插件对你有帮助,请在 GitHub 上给我一个星星⭐,这对我来说是十足的激励
31-
<p align="center"><strong>Enjoy!祝愿你早安午安晚安</strong></p>
33+
若这个插件保护了您的重要代码,请在 GitHub 上大方地赐予一颗星星哦 ⭐,这对我是莫大的动力激励
34+
<p align="center"><strong>Enjoy! 祝愿你早安午安晚安</strong></p>
3235
<p align="center">Co-build with <strong>AI</strong></p>

docs/README_en.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,24 @@
22

33
<pre align="center"> <a href="https://github.com/2bitbit/trash4wsl-in-vscode/blob/main/README.md">简体中文</a> | English</pre>
44

5-
In VSCode WSL (or other remote connections), no more worries about permanent file deletion without regret. Now enjoy a charming recycle bin (based on trash-cli implementation).
5+
In VSCode WSL (or other remote connections), no more worries about permanent file deletion without regret. Now enjoy a charming, lightning-fast native recycle bin (Powered by Rust & NAPI-RS - no dependencies required).
66

77
<img src="../trash4wsl-demo.gif" alt="demo" width="500" height="auto">
88

9-
## Features
10-
- Support for multi-root workspaces
11-
- Support for delete, search, restore, and empty operations
12-
- Support for WSL and other remote connections
13-
- Support for shortcuts (default: `delete` to delete selected files, `ctrl+shift+delete` to open trash panel)
14-
- Clean and simple GUI
9+
## Features (v2.0 Native Edition)
10+
- **Zero Dependencies**: Completely rewrote the backend in Rust via NAPI-RS. Say goodbye to the Python `trash-cli` dependency! It works out-of-the-box natively.
11+
- **Granular Multi-root Workspace Support**: Workspace-aware listing and purging, preventing accidental deletion of files outside your active projects.
12+
- **Safe Execution Environment**: Direct fs manipulations, fully immune to shell command injections.
13+
- **Classic VSCode UI Integration**: Search, filter, and restore files instantly using the lightweight QuickPick floating menu.
14+
- **Shortcut Support**: Use the standard `delete` key in the explorer to safely move items to the trash, or `ctrl+shift+delete` to open the interactive panel.
1515

1616
## How to Use
17-
1. Install trash-cli in the target environment terminal: `apt install trash-cli`
18-
2. Search for `trash4wsl-in-vscode` in VSCode Marketplace and install this extension to your workspace
19-
3. Select files, right-click and choose `trash-put (via trash-cli)` or use the shortcut `delete` to delete selected files
20-
4. Use `ctrl+shift+p` or the shortcut `ctrl+shift+delete` to open the trash panel for related operations
17+
1. Search for `trash4wsl-in-vscode` in VSCode Marketplace and install this extension to your workspace. (No extra dependencies needed!)
18+
2. Select files, right-click and choose `Trash` or use the shortcut `delete` to safely move selected files to the recycle bin.
19+
3. Use `ctrl+shift+p` and type "Browse Trash" or use the shortcut `ctrl+shift+delete` to open the interactive trash panel for restorations.
2120

22-
>Tip: The default trash directory is located at `~/.local/share/Trash/files`.
21+
>Tip: The default linux trash directory conforms to the FreeDesktop specification: `~/.local/share/Trash/files`.
2322
24-
## Dependencies
25-
- trash-cli
26-
- VSCode
27-
28-
29-
If this extension is helpful to you, please give it a star on GitHub! Your support means a lot to me. ⭐
30-
<p align="center"><strong>Enjoy! Wishing you good morning, good afternoon, and good night</strong></p>
31-
<p align="center">Co-build with <strong>AI</strong></p>
23+
## Enjoy!
24+
If this extension is helpful to you, please consider giving it a star on GitHub! Your support means a lot. ⭐
25+
<p align="center">Co-built with <strong>AI</strong></p>

esbuild.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ async function main() {
3535
sourcesContent: false,
3636
platform: 'node',
3737
outfile: 'dist/extension.js',
38-
external: ['vscode'],
38+
external: ['vscode', '*.node'],
39+
loader: { '.node': 'file' },
3940
logLevel: 'silent',
4041
plugins: [
4142
/* add to the end of plugins array */

native-bindings/index.d.ts

Whitespace-only changes.
18.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)