Skip to content

Commit

Permalink
fix: Web Extension fails to load in VSCode 1.92.0
Browse files Browse the repository at this point in the history
  • Loading branch information
slavek-kucera authored Jul 9, 2024
1 parent 5427ca0 commit 1dc6237
Show file tree
Hide file tree
Showing 6 changed files with 679 additions and 114 deletions.
3 changes: 3 additions & 0 deletions clients/vscode-hlasmplugin/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ start_release.sh
terse/**
tsconfig.json
CMakeLists.txt
bin/wasm/*
!bin/wasm/hlasm_language_server.wasm
!bin/wasm/hlasm_language_server_web.js
1 change: 1 addition & 0 deletions clients/vscode-hlasmplugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#### Fixed
- Accept additional URI schemes based on currently opened workspaces
- Web Extension fails to load in VSCode 1.92.0

## [1.13.0](https://github.com/eclipse-che4z/che-che4z-lsp-for-hlasm/compare/1.12.0...1.13.0) (2024-04-24)

Expand Down
35 changes: 35 additions & 0 deletions clients/vscode-hlasmplugin/build/bin/bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,41 @@ for (const bd of buildDetails) {
});
}

if (target === 1) {
const main = fs.readFileSync('bin/wasm/hlasm_language_server.mjs', { encoding: 'utf8' });
const worker = `
if (!isPthread) {
const tmpQueue = [];
self.onmessage = (event) => {
self.onmessage = (event) => { tmpQueue.push(event); };
const { extensionUri, arguments } = event.data;
return Module({
tmpQueue,
worker: self,
arguments,
locateFile(path) {
if (typeof path !== 'string') return path;
if (path.endsWith(".wasm")) {
return extensionUri + 'bin/wasm/hlasm_language_server.wasm';
}
return path;
},
});
}
}
`;
const superRunner = main
.replaceAll('import.meta.url', 'self.location.href')
.replace('"type":"module",', '')
.replace('export default Module', '// export default Module')
.replace('if (isNode)', '// if (isNode)')
.concat(worker);

fs.writeFileSync('bin/wasm/hlasm_language_server_web.js', superRunner);
}

console.log('Done!');

// details follow
Expand Down
Loading

0 comments on commit 1dc6237

Please sign in to comment.