Skip to content

Commit

Permalink
add remove from exlclusion list and conversion tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostboats committed May 14, 2024
1 parent 8ab5a3c commit 4e39d93
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
19 changes: 15 additions & 4 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ const { resizeImageTooltip, resizeImageController, resizeImageHotbar, resizeImag

const { getFullPath } = require('./support_files/helper_functions');

/**
* Adds a file to the exclusion list.
* @param {vscode.Uri} fileUri - The URI of the file to be excluded.
*/

async function addToExcludeList(fileUri) {
const config = vscode.workspace.getConfiguration('bg3ModHelper');
let excludedFiles = config.get('excludedFiles') || [];
Expand All @@ -54,6 +51,19 @@ async function addToExcludeList(fileUri) {
}
}

async function removeFromExcludeList(fileUri) {
const config = vscode.workspace.getConfiguration('bg3ModHelper');
let excludedFiles = config.get('excludedFiles') || [];
const filePath = fileUri.fsPath.replace(/\\/g, '/');

if (excludedFiles.includes(filePath)) {
excludedFiles = excludedFiles.filter(p => p !== filePath); // Remove the file from the list
await config.update('excludedFiles', excludedFiles, vscode.ConfigurationTarget.Global);
vscode.window.showInformationMessage(`${filePath} removed from conversion exclusion list.`);
} else {
vscode.window.showWarningMessage(`${filePath} not in the exclusion list.`);
}
}

/**
* @param {vscode.ExtensionContext} context
Expand Down Expand Up @@ -146,6 +156,7 @@ function activate(context) {

let createModTemplateCommand = vscode.commands.registerCommand('bg3-mod-helper.createModTemplate', createModTemplateImport);
context.subscriptions.push(vscode.commands.registerCommand('bg3-mod-helper.addToExcludeList', addToExcludeList));
context.subscriptions.push(vscode.commands.registerCommand('bg3-mod-helper.removeFromExcludeList', removeFromExcludeList));
context.subscriptions.push(uuidsHandlesHoverProvider, functionsHoverProvider, DDSToPNG, PNGToDDS, resizeTooltipCommand, resizeControllerCommand, resizeHotbarCommand, resizeCustomCommand, createModTemplateCommand, addIconBackgroundCommand, openConverterCommand, versionGeneratorCommand, rotationToolCommand);
}

Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@
"title": "Add to Conversion Exclusion List",
"category": "BG3 Mod Helper"
},
{
"command": "bg3-mod-helper.removeFromExcludeList",
"title": "Remove from Conversion Exclusion List",
"category": "BG3 Mod Helper"
},
{
"command": "bg3-mod-helper.debugCommand",
"title": "For dev use, dont press the button"
Expand Down Expand Up @@ -285,9 +290,14 @@
"group": "navigation"
},
{
"when": "resourceExtname == .lsx || resourceExtname == .loca || resourceExtname == .xml || resourceExtname == .lsf",
"when": "resourceExtname == .lsx || resourceExtname == .loca || resourceExtname == .xml || resourceExtname == .lsf && !isExcluded",
"command": "bg3-mod-helper.addToExcludeList",
"group": "navigation"
},
{
"when": "resourceExtname == .lsx || resourceExtname == .loca || resourceExtname == .xml || resourceExtname == .lsf && isExcluded",
"command": "bg3-mod-helper.removeFromExcludeList",
"group": "navigation"
}
],
"editor/context": [
Expand Down

0 comments on commit 4e39d93

Please sign in to comment.