Skip to content

Commit 5150623

Browse files
authored
feat(amazonq): bundle stripped indexing folder for @file support in fallback LSP (#8591)
## Problem When users behind corporate proxies/firewalls can't download the LSP from CDN, the extension falls back to a bundled LSP. The bundled LSP currently excludes the entire indexing/ folder (~200MB), which means @file, @folder, and @code context commands don't work for these users. ## Solution Instead of deleting the entire `indexing` folder during bundling, selectively strip only the heavy platform-specific files that aren't needed for context commands: - dist/bin/ — ONNX native binaries (25MB) - dist/build/ — faiss native binaries (11MB) - models/ — CodeSage ONNX model (124MB) This keeps extension.js, lspServer.js, tree-sitter WASMs (~30MB uncompressed, ~3MB compressed in VSIX), which is everything needed for @file, @folder, @code, and BM25 cross-file context. VSIX size impact: +3MB (19MB → 22MB) Depends on aws/language-servers#2629: (CDN must have the updated indexing library)
1 parent 613a66d commit 5150623

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

scripts/lspArtifact.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,22 @@ export async function downloadLanguageServer(): Promise<void> {
152152

153153
// Clean up temp directory
154154
fs.rmdirSync(tempDir)
155-
fs.rmdirSync(path.join(resourcesDir, 'servers', 'indexing'), { recursive: true })
155+
// Strip heavy native/model files from indexing, keep tree-sitter + extension.js
156+
const indexingDir = path.join(resourcesDir, 'servers', 'indexing')
157+
if (fs.existsSync(indexingDir)) {
158+
const binDir = path.join(indexingDir, 'dist', 'bin')
159+
if (fs.existsSync(binDir)) {
160+
fs.rmdirSync(binDir, { recursive: true })
161+
}
162+
const buildDir = path.join(indexingDir, 'dist', 'build')
163+
if (fs.existsSync(buildDir)) {
164+
fs.rmdirSync(buildDir, { recursive: true })
165+
}
166+
const modelsDir = path.join(indexingDir, 'models')
167+
if (fs.existsSync(modelsDir)) {
168+
fs.rmdirSync(modelsDir, { recursive: true })
169+
}
170+
}
156171
fs.rmdirSync(path.join(resourcesDir, 'servers', 'ripgrep'), { recursive: true })
157172
fs.rmSync(path.join(resourcesDir, 'servers', 'node'))
158173
if (!fs.existsSync(path.join(resourcesDir, 'servers', 'aws-lsp-codewhisperer.js'))) {

0 commit comments

Comments
 (0)