diff --git a/package.json b/package.json index 7b962f2..1098a92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opendream", - "version": "0.1.0", + "version": "0.1.1", "displayName": "OpenDream dev tools", "description": "Developer tools for OpenDream", "publisher": "platymuus", @@ -38,6 +38,11 @@ "type": "string", "default": null, "description": "Path to your copy of the OpenDream source code." + }, + "opendream.additionalArgs": { + "type": "string", + "default": null, + "description": "Additional arguments to pass to the OpenDream compiler" } } }, @@ -45,19 +50,19 @@ { "name": "openDreamCompiler", "owner": "opendream", - "source": "OpenDream", + "source": "OpenDream", "fileLocation": [ "relative", "${workspaceFolder}" ], - "pattern": { - "regexp": "^(\\w+) at (.+):(\\d+):(\\d+): (.+)$", - "severity": 1, - "file": 2, - "line": 3, - "column": 4, - "message": 5 - } + "pattern": { + "regexp": "^(\\w+) at (.+):(\\d+):(\\d+): (.+)$", + "severity": 1, + "file": 2, + "line": 3, + "column": 4, + "message": 5 + } } ], "taskDefinitions": [ diff --git a/src/extension.ts b/src/extension.ts index c5c0993..09ab523 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -111,6 +111,9 @@ class OpenDreamTaskProvider implements TaskProvider { return []; } + let additionalArgs: string | undefined = workspace.getConfiguration('opendream').get('additionalArgs'); + additionalArgs = additionalArgs ?? "" // `ProcessExecution` can't handle args that are `undefined` + let list = []; // Add build tasks for each .dme in the workspace. @@ -125,7 +128,7 @@ class OpenDreamTaskProvider implements TaskProvider { folder, TaskNames.RUN_COMPILER(file), TaskNames.SOURCE, - openDream.getCompilerExecution(file), + openDream.getCompilerExecution(file, additionalArgs), '$openDreamCompiler' ); task.group = TaskGroup.Build; @@ -242,7 +245,7 @@ class OpenDreamDebugAdapter implements vscode.DebugAdapter { // Abstraction over possible OpenDream installation methods. interface OpenDreamInstallation { - getCompilerExecution(dme: string): ProcessExecution | vscode.ShellExecution | vscode.CustomExecution; + getCompilerExecution(dme: string, additionalArgs: string): ProcessExecution | vscode.ShellExecution | vscode.CustomExecution; buildClient(workspaceFolder?: vscode.WorkspaceFolder): Promise; startServer(params: { workspaceFolder?: vscode.WorkspaceFolder, debugPort: number, json_path: string }): Promise; } @@ -317,9 +320,10 @@ class ODBinaryDistribution implements OpenDreamInstallation { this.path = path; } - getCompilerExecution(dme: string): ProcessExecution { + getCompilerExecution(dme: string, addditionalArgs: string): ProcessExecution { return new ProcessExecution(`${this.path}/DMCompiler`, [ dme, + addditionalArgs, ]); } @@ -363,12 +367,13 @@ class ODSourceInstallation implements OpenDreamInstallation { this.path = path; } - getCompilerExecution(dme: string): ProcessExecution { + getCompilerExecution(dme: string, additionalArgs: string): ProcessExecution { return new ProcessExecution("dotnet", [ "run", "--project", `${this.path}/DMCompiler`, "--", dme, + additionalArgs, ]); }