Updated settings and script compilnig

This commit is contained in:
ex61wi
2026-04-07 10:46:17 +02:00
parent 3083cf4b0b
commit fddf8e3946
4 changed files with 57 additions and 21 deletions
+5
View File
@@ -11,6 +11,11 @@ Direct DCS API checking and a Transpiler that can help keep huge complex scripts
## Release Notes
### 0.0.2
- Improved error handling and reporting in the script compiler.
- Added Output channel for compilation logs and errors.
- Improved Settings for better user experience.
### 0.0.1
+11 -2
View File
@@ -49,8 +49,17 @@
"type": "boolean",
"default": false,
"description": "Adds an additional script. This can be referenced from DCS through doScriptFile. This will then execute the compiles script. This way you don't have to reinsert the script on each change, but can just hit 'restart'."
}
},
"dutchies-dcs-scripting-tools.luaSrcDirectory" : {
"type":"string",
"default": "${workspaceFolder}/src",
"description": "Where the source files start. default: ${workspaceFolder}/src"
},
"dutchies-dcs-scripting-tools.luaOutputPath" : {
"type":"string",
"default": "${workspaceFolder}/dist",
"description": "Where the compiled Lua files will be output. default: ${workspaceFolder}/dist"
}
}
},
"grammars": [
+21 -16
View File
@@ -27,21 +27,13 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.enable', async () => {
addPluginPathToSettings();
await vscode.commands.executeCommand(
"lua.startServer"
);
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools enabled.');
enableIntellisense();
})
);
context.subscriptions.push(
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.disable', async () => {
removePluginPathFromSettings();
await vscode.commands.executeCommand(
"lua.startServer"
);
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools disabled.');
disableIntellisense();
})
);
@@ -116,11 +108,10 @@ async function compileLuaScripts() {
logger.clear();
logger.info("Compiling...");
const config = vscode.workspace.getConfiguration('dcsScriptingTools');
const sourcePath = config.get<string>('luaSourcePath') || '${workspaceFolder}/src';
const config = vscode.workspace.getConfiguration(extensionName);
const sourcePath = config.get<string>('luaSrcDirectory') || '${workspaceFolder}/src';
const outputPath = config.get<string>('luaOutputPath') || '${workspaceFolder}/dist';
const minify = config.get<boolean>('minifyLuaScripts') || false;
const resolvedSourcePath = sourcePath.replace('${workspaceFolder}', vscode.workspace.workspaceFolders?.[0].uri.fsPath || '');
const resolvedOutputPath = outputPath.replace('${workspaceFolder}', vscode.workspace.workspaceFolders?.[0].uri.fsPath || '');
@@ -130,7 +121,7 @@ async function compileLuaScripts() {
const options: ScriptCompilerOptions = {
sourcePath: resolvedSourcePath,
outputPath: resolvedOutputPath,
minify: minify,
minify: false,
onError: (error: CompilationError) => {
const errors = errorsByFile.get(error.filePath) || [];
errors.push(error);
@@ -140,8 +131,11 @@ async function compileLuaScripts() {
const compilationLogger = new CompilationLogger(logger);
const compiler = new ScriptCompiler(options, compilationLogger);
const includeDevScript = config.get<boolean>('includeDevelopmentScript') || false;
try {
await compiler.compile();
await compiler.compile(includeDevScript);
} catch (err) {
vscode.window.showErrorMessage('Compilation failed: ' + (err as Error).message);
}
@@ -161,6 +155,12 @@ async function compileLuaScripts() {
}
async function enableIntellisense() {
const config = vscode.workspace.getConfiguration(extensionName);
if (config.get<boolean>("dcsTypes") === false) {
config.update("dcsTypes", true, vscode.ConfigurationTarget.Workspace);
}
addPluginPathToSettings();
await vscode.commands.executeCommand(
"lua.startServer"
@@ -169,6 +169,11 @@ async function enableIntellisense() {
}
async function disableIntellisense() {
const config = vscode.workspace.getConfiguration(extensionName);
if (config.get<boolean>("dcsTypes") === true) {
config.update("dcsTypes", false, vscode.ConfigurationTarget.Workspace);
}
removePluginPathFromSettings();
await vscode.commands.executeCommand(
"lua.startServer"