github.com
newdlops/vscode-auto-import — GitHub
Source code for the Rust daemon and VS Code thin client. 29 end-to-end tests · MIT license · 1 contributor · 0 open issues

Auto Import Plus (v0.1.3, MIT) replaces WASM-based auto-import logic with a native Rust daemon that indexes TypeScript/JavaScript/Python/Java across a full workspace — cold-scanning 22k files in 2–4 s with sub-millisecond query latency.

newdlops.vscode-auto-import, v0.1.3) takes a different architectural bet: instead of running import resolution inside a WebAssembly sandbox inside VS Code, it compiles a small Rust binary on first activation and runs the whole indexer as a native OS daemon. The VS Code extension is reduced to a 500-line TypeScript IPC client.site-packages directory with 10,000+ files, and the WASM-based tree-sitter grammars used by most community extensions start producing Aborted() / memory access out of bounds panics. The author's own TypeScript + WASM prototype logged 5,711 such crashes in a single session before the rewrite. 2newdlops.vscode-auto-importcargo build --release --lockeddaemon/ source directory. If no cargo is found on your PATH, the extension downloads rustup-init, verifies the SHA-256, and installs a minimal Rust toolchain under its own CARGO_HOME. This happens once; subsequent starts load the cached binary. 1Corporate / offline machines: first activation needs access tostatic.rust-lang.organdcrates.io. If those are blocked, pre-install Rust manually and makecargoavailable on thePATHbefore opening VS Code. 1
Windows: you may need Microsoft C++ Build Tools for the native C dependencies used by the tree-sitter bindings.
autoImport.maxResults) ranked by this formula:score = prefix_match_weight × 10
+ last_used_recency × 2
+ path_depth_penalty (−0.5 × depth)
+ is_default_export × 1
+ re_export_penalty (−0.3)// named
import { UserAccount } from './models/user';
// default
import ApiClient from './api/client';
// type-only (when autoImport.typescript.preferTypeImports = "always")
import type { UserId } from './types';index.ts contains export * from './foo', you can import Bar directly from index.ts rather than having to track down the originating file. 1__init__.py resolution:# direct module symbol
from pkg.models import Account
# barrel via __init__.py (when __init__.py has: from .sub import Account)
from pkg import Accountimport com.example.service.UserService;
// inner class (autoImport.java.includeInnerClasses must be true)
import com.example.model.Outer.Inner;| Metric | Rust daemon (v0.1.x) | V1 TS/WASM prototype |
|---|---|---|
| Cold workspace scan | 2–4 s | 18–25 s |
| Library scan (10k+ files) | 3–6 s, 0 crashes | 8–18 s, ~5,700 crashes |
| Warm query (1–2 char prefix) | < 1 ms | 1–3 ms |
| Repeat cold start (cache hit) | < 500 ms | Full rescan |
steoates.autoimport. The self-reported numbers are plausible given the architecture, but they have not been independently verified. The crash-elimination claim is the stronger story: native C FFI bindings replace the WASM grammars that were causing the Aborted() panics.{
// Languages to index (default: all four)
"autoImport.languages": ["typescript", "javascript", "python", "java"],
// Start suggesting after the first character (default: 1)
"autoImport.minPrefixLength": 1,
// Prefer "import type" where possible
"autoImport.typescript.preferTypeImports": "auto", // "auto" | "always" | "never"
// Include Java inner classes in the index
"autoImport.java.includeInnerClasses": false,
// How much disk space the cache may use
"autoImport.cache.maxDiskMB": 100
}.vscode/.auto-import-cache/index.bin (bincode format). Add that path to .gitignore — it's machine-specific and regenerates quickly on cache miss..code-workspace files) are not supported in the current version.paths aliases from tsconfig.json, dynamic import() expressions, Python import * and namespace packages, Java static import, and Maven/Gradle multi-module project layouts. Whether these work, partially work, or are silently ignored is unknown — the official docs don't address them.Source code for the Rust daemon and VS Code thin client. 29 end-to-end tests · MIT license · 1 contributor · 0 open issues
Rust-powered workspace-wide auto-import for TypeScript, JavaScript, Python, and Java. v0.1.3 · Publisher: newdlops · License: MIT
Architecture spec for the Rust daemon: JSON-RPC protocol, scoring formula, out-of-scope features, and the rationale for moving from WASM tree-sitter to native C FFI bindings.
围绕这条内容继续补充观点或上下文。