Skip to content

Commit

Permalink
add workerpool dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
khbsd committed May 22, 2024
1 parent dbaf936 commit e397815
Show file tree
Hide file tree
Showing 45 changed files with 5,688 additions and 7 deletions.
40 changes: 40 additions & 0 deletions commands/debug2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const vscode = require('vscode');
const fs = require('fs');
const os = require('os');

const { Worker, isMainThread, parentPort } = require('worker_threads');
const path = require('path');
const { getConfig } = require('../support_files/config');

const { CREATE_LOGGER, raiseError, raiseInfo } = require('../support_files/log_utils.js');
const bg3mh_logger = CREATE_LOGGER();

const debug2 = vscode.commands.registerCommand('bg3-mod-helper.debug2Command', async function () {
const config = getConfig();
const localizationPath = path.join(config.rootModPath, 'Localization');
let coreCount = os.availableParallelism();

raiseInfo(`half of your cpu's cores: ${coreCount / 2}`);


if (isMainThread) {
const testWorker = new Worker(__filename);

console.log("in main thread");

testWorker.on('message', (msg) => {
console.log(msg);
});
}
else {
console.log("in worker thread");
parentPort.postMessage("hi");
}

// after you are through with this command, the following line must be uncommented and the only thing left for this file to be considered cleaned up.
// raiseInfo("hi dipshit :)");


});

module.exports = debug2;
8 changes: 5 additions & 3 deletions commands/openConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ const vscode = require('vscode');
const { CREATE_LOGGER, raiseError } = require('../support_files/log_utils.js');
const bg3mh_logger = CREATE_LOGGER();

const { lsx, lsf, xml, loca } = require('../support_files/lslib_utils.js').getFormats();

var lsxFiles;
var lsfFiles;
var xmlFiles;
var locaFiles;


async function refreshFiles() {
lsxFiles = await vscode.workspace.findFiles('**/*.lsx');
lsxFiles = await vscode.workspace.findFiles('**/*'.concat(lsx));
// added extra files that should be shown in the lsf panel of the webview
lsfFiles = await vscode.workspace.findFiles('**/*.{lsf,lsfx,lsc,lsj,lsbc,lsbs}');
xmlFiles = await vscode.workspace.findFiles('**/*.xml');
locaFiles = await vscode.workspace.findFiles('**/*.loca');
xmlFiles = await vscode.workspace.findFiles('**/*'.concat(xml));
locaFiles = await vscode.workspace.findFiles('**/*'.concat(loca));
}


Expand Down
12 changes: 12 additions & 0 deletions commands/worker_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { CREATE_LOGGER, raiseError, raiseInfo } = require('../support_files/log_utils.js');
const bg3mh_logger = CREATE_LOGGER();

const { parentPort } = require('worker_threads');

function test_func() {
raiseInfo("hi dipshit :)");
return "hi dipshit :)";

}


4 changes: 3 additions & 1 deletion extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const { CREATE_LOGGER } = require('./support_files/log_utils');
var bg3mh_logger = CREATE_LOGGER();

const debugCommand = require('./commands/debug');
const debug2Command = require('./commands/debug2');
const setupFunctionDescriptionHoverProvider = require('./hovers/functionDescriptions');
const setupUuidsHandlesHoverProvider = require('./hovers/uuidsHandlesCollector');
const { resizeImageTooltip, resizeImageController, resizeImageHotbar, resizeImageCustom } = require('./commands/resizeImage');
Expand Down Expand Up @@ -185,7 +186,8 @@ function aSimpleDataProvider() {
{ label: 'Version Generator', command: 'bg3-mod-helper.versionGenerator' },
{ label: 'Rotation Tool (in development)', command: 'bg3-mod-helper.rotationTool' },
{ label: 'DDS Viewer (in development)', command: 'bg3-mod-helper.DDSViewer' },
{ label: 'Debug Command', command: 'bg3-mod-helper.debugCommand' }
{ label: 'Debug Command', command: 'bg3-mod-helper.debugCommand' },
{ label: 'Debug2 Command', command: 'bg3-mod-helper.debug2Command' }
]);
} else if (element.id === 'packer') {
return Promise.resolve([
Expand Down
5 changes: 5 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e397815

Please sign in to comment.