Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(vscode): add problem matcher to highlight errors after build #437

Merged
merged 1 commit into from
Mar 10, 2025
Merged
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
13 changes: 13 additions & 0 deletions client/src/build-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export class BlueprintTaskProvider implements TaskProviderBase {
panel: vscode.TaskPanelKind.Dedicated,
focus: true,
}

const settings = vscode.workspace.getConfiguration("tact")
const useProblemMatcher = settings.get<boolean>("linters.useProblemMatcher") ?? false
if (useProblemMatcher) {
task.problemMatchers = ["$tact"]
}

return task
}
}
Expand Down Expand Up @@ -118,6 +125,12 @@ export class TactTemplateTaskProvider implements TaskProviderBase {
focus: true,
}

const settings = vscode.workspace.getConfiguration("tact")
const useProblemMatcher = settings.get<boolean>("linters.useProblemMatcher") ?? false
if (useProblemMatcher) {
task.problemMatchers = ["$tact"]
}

return task
}
}
Expand Down
30 changes: 29 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@
"command": "tact.build",
"title": "Build Project",
"category": "Tact",
"icon": "$(gear)"
"icon": "$(gear)",
"problemMatcher": [
"$tact"
]
},
{
"command": "tact/getTypeAtPosition",
Expand Down Expand Up @@ -436,6 +439,11 @@
"default": false,
"description": "Enable Tact compiler analysis"
},
"tact.linters.useProblemMatcher": {
"type": "boolean",
"default": false,
"description": "Highlight errors in editor after build"
},
"tact.linters.misti.enable": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -486,6 +494,26 @@
"type": "tact-template-test",
"properties": {}
}
],
"problemMatchers": [
{
"name": "tact",
"owner": "tact",
"fileLocation": [
"relative",
"${workspaceFolder}"
],
"pattern": [
{
"regexp": "^Error:\\s+(.+):(\\d+):(\\d+):\\s+(.+)$",
"file": 1,
"line": 2,
"column": 3,
"message": 4
}
],
"severity": "error"
}
]
},
"dependencies": {
Expand Down
4 changes: 4 additions & 0 deletions server/src/utils/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface TactSettings {
enable: boolean
binPath: string
}
useProblemMatcher: boolean
}
}

Expand Down Expand Up @@ -137,6 +138,7 @@ const defaultSettings: TactSettings = {
enable: false,
binPath: "npx misti",
},
useProblemMatcher: false,
},
}

Expand Down Expand Up @@ -241,6 +243,8 @@ function mergeSettings(vsSettings: Partial<TactSettings>): TactSettings {
enable: vsSettings.linters?.misti.enable ?? defaultSettings.linters.misti.enable,
binPath: vsSettings.linters?.misti.binPath ?? defaultSettings.linters.misti.binPath,
},
useProblemMatcher:
vsSettings.linters?.useProblemMatcher ?? defaultSettings.linters.useProblemMatcher,
},
}
}
Expand Down