Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Extension setting for additional compiler arguments #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -38,26 +38,31 @@
"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"
}
}
},
"problemMatchers": [
{
"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": [
Expand Down
13 changes: 9 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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<ODClient>;
startServer(params: { workspaceFolder?: vscode.WorkspaceFolder, debugPort: number, json_path: string }): Promise<void>;
}
Expand Down Expand Up @@ -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,
]);
}

Expand Down Expand Up @@ -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,
]);
}

Expand Down