Skip to content

Commit 7ceeb57

Browse files
committed
fix tree-sitter binary dependency
1 parent f27453d commit 7ceeb57

File tree

3 files changed

+9
-54
lines changed

3 files changed

+9
-54
lines changed

.vscodeignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@
88
!README.md
99
!assets/extension-logo.png
1010
!out/extension.js
11-
!webview-ui/public
11+
!webview-ui/public
12+
13+
# order matters here - keep tree sitter dependency
14+
!node_modules/tree-sitter
15+
!node_modules/node-gyp-build
16+
!node_modules/node-addon-api
17+
18+
# but do NOT keep the .node files
19+
**/*.node

src/Installer.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -295,42 +295,3 @@ export function removeLanguage(parsersDir: string, languageId: string): void {
295295
}
296296
logger.log(`Removed parser '${parserPackagePath}'`);
297297
}
298-
299-
export async function installTreeSitter(extensionDir: string, npm: string): Promise<Result<void, string>> {
300-
const logger = getLogger();
301-
302-
// try to load tree-sitter optimistically
303-
try {
304-
await import("tree-sitter");
305-
return ok(undefined);
306-
} catch (_) {
307-
logger.log(`Tree-sitter not found, installing it with npm`);
308-
}
309-
310-
const result = await vscode.window.withProgress(
311-
{
312-
location: vscode.ProgressLocation.Notification,
313-
cancellable: false,
314-
title: `Installing extension dependencies`,
315-
},
316-
async (progress) =>
317-
await runCmd(`${npm} install --loglevel=silly --production`, { cwd: extensionDir }, (d) =>
318-
progress.report({ message: d.toString() })
319-
)
320-
);
321-
322-
if (result.status === "ok") {
323-
return ok(undefined);
324-
}
325-
326-
const msg =
327-
"Failed to install extension dependencies > " +
328-
result.result[0].name +
329-
": " +
330-
result.result[0].message.replace(/\n/g, " > ") +
331-
(result.result[1].length > 1 ? ` Logs: ${result.result[1].join(">")}` : "");
332-
333-
void vscode.window.showErrorMessage(msg);
334-
logger.log(msg);
335-
return err(msg);
336-
}

src/extension.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,6 @@ export { BlockMode };
101101
export function activate(context: vscode.ExtensionContext): void {
102102
getLogger().log("CodeBlocks activated");
103103

104-
const npm = "npm";
105-
106-
Installer.installTreeSitter(context.extensionPath, npm)
107-
.then(() => _activate(context))
108-
.catch(() => {
109-
vscode.window.showErrorMessage(
110-
"Failed to install Tree-sitter. Please ensure that Node.js and npm are installed and available in your PATH."
111-
);
112-
});
113-
}
114-
115-
export function _activate(context: vscode.ExtensionContext): void {
116-
getLogger().log("CodeBlocks _activated");
117-
118104
const parsersDir = join(
119105
context.extensionPath,
120106
context.extensionMode === vscode.ExtensionMode.Test ? "test-parsers" : "parsers"

0 commit comments

Comments
 (0)