Skip to content

Commit b2ad48a

Browse files
authored
feat(vscode): add problem matcher to highlight errors after build (#437)
1 parent 0330633 commit b2ad48a

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

client/src/build-system.ts

+13
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ export class BlueprintTaskProvider implements TaskProviderBase {
6262
panel: vscode.TaskPanelKind.Dedicated,
6363
focus: true,
6464
}
65+
66+
const settings = vscode.workspace.getConfiguration("tact")
67+
const useProblemMatcher = settings.get<boolean>("linters.useProblemMatcher") ?? false
68+
if (useProblemMatcher) {
69+
task.problemMatchers = ["$tact"]
70+
}
71+
6572
return task
6673
}
6774
}
@@ -118,6 +125,12 @@ export class TactTemplateTaskProvider implements TaskProviderBase {
118125
focus: true,
119126
}
120127

128+
const settings = vscode.workspace.getConfiguration("tact")
129+
const useProblemMatcher = settings.get<boolean>("linters.useProblemMatcher") ?? false
130+
if (useProblemMatcher) {
131+
task.problemMatchers = ["$tact"]
132+
}
133+
121134
return task
122135
}
123136
}

package.json

+29-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@
121121
"command": "tact.build",
122122
"title": "Build Project",
123123
"category": "Tact",
124-
"icon": "$(gear)"
124+
"icon": "$(gear)",
125+
"problemMatcher": [
126+
"$tact"
127+
]
125128
},
126129
{
127130
"command": "tact/getTypeAtPosition",
@@ -436,6 +439,11 @@
436439
"default": false,
437440
"description": "Enable Tact compiler analysis"
438441
},
442+
"tact.linters.useProblemMatcher": {
443+
"type": "boolean",
444+
"default": false,
445+
"description": "Highlight errors in editor after build"
446+
},
439447
"tact.linters.misti.enable": {
440448
"type": "boolean",
441449
"default": false,
@@ -486,6 +494,26 @@
486494
"type": "tact-template-test",
487495
"properties": {}
488496
}
497+
],
498+
"problemMatchers": [
499+
{
500+
"name": "tact",
501+
"owner": "tact",
502+
"fileLocation": [
503+
"relative",
504+
"${workspaceFolder}"
505+
],
506+
"pattern": [
507+
{
508+
"regexp": "^Error:\\s+(.+):(\\d+):(\\d+):\\s+(.+)$",
509+
"file": 1,
510+
"line": 2,
511+
"column": 3,
512+
"message": 4
513+
}
514+
],
515+
"severity": "error"
516+
}
489517
]
490518
},
491519
"dependencies": {

server/src/utils/settings.ts

+4
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export interface TactSettings {
6868
enable: boolean
6969
binPath: string
7070
}
71+
useProblemMatcher: boolean
7172
}
7273
}
7374

@@ -137,6 +138,7 @@ const defaultSettings: TactSettings = {
137138
enable: false,
138139
binPath: "npx misti",
139140
},
141+
useProblemMatcher: false,
140142
},
141143
}
142144

@@ -241,6 +243,8 @@ function mergeSettings(vsSettings: Partial<TactSettings>): TactSettings {
241243
enable: vsSettings.linters?.misti.enable ?? defaultSettings.linters.misti.enable,
242244
binPath: vsSettings.linters?.misti.binPath ?? defaultSettings.linters.misti.binPath,
243245
},
246+
useProblemMatcher:
247+
vsSettings.linters?.useProblemMatcher ?? defaultSettings.linters.useProblemMatcher,
244248
},
245249
}
246250
}

0 commit comments

Comments
 (0)