summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVeesh Goldman <rabbiveesh@gmail.com>2024-09-01 22:16:29 +0300
committerVeesh Goldman <rabbiveesh@gmail.com>2024-09-01 22:16:29 +0300
commit7129ef83b37757b63e33d402dc27061ecd9af5e6 (patch)
tree6dba521d66be4009725500d125521480e895bd46
parent597da6f89d6cd6f9dac2c39a8ce02e449345c6e4 (diff)
downloadPerlNavigator-7129ef83b37757b63e33d402dc27061ecd9af5e6.zip
fix: find oniguruma dynamically
-rw-r--r--server/src/parser.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/src/parser.ts b/server/src/parser.ts
index 700a5a5..4d8c731 100644
--- a/server/src/parser.ts
+++ b/server/src/parser.ts
@@ -594,7 +594,13 @@ function PackageEndLine(state: ParserState) {
return state.codeArray.length;
}
-const wasmBin = fs.readFileSync(path.join(__dirname, "./../node_modules/vscode-oniguruma/release/onig.wasm")).buffer;
+// Resolve the path to the vscode-oniguruma package
+const onigurumaPkgPath = path.dirname(require.resolve('vscode-oniguruma/package.json'));
+console.log(onigurumaPkgPath);
+// Construct the path to onig.wasm
+const onigWasmPath = path.join(onigurumaPkgPath, 'release', 'onig.wasm');
+// Read the file
+const wasmBin = fs.readFileSync(onigWasmPath).buffer;
const vscodeOnigurumaLib = oniguruma.loadWASM(wasmBin).then(() => {
return {
createOnigScanner(patterns: any) {