-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Apply problem matchers specified by task provider #8756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spoenemann the plugin-ext
unit-tests will need to be adjusted for the tasks
, it is currently failing.
c6a21cf
to
651853d
Compare
I fixed the test, but don't see why the build is still failing. I also added a |
I restarted the build, the typescript tests fail intermittently: #8360. |
Thanks @vince-fugnitto! Any opinion on the |
@@ -705,6 +705,9 @@ export function fromTask(task: theia.Task): TaskDto | undefined { | |||
const taskDto = {} as TaskDto; | |||
taskDto.label = task.name; | |||
taskDto.source = task.source; | |||
if (task.problemMatchers) { | |||
taskDto.problemMatcher = task.problemMatchers; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
I see you provided the changes for fromTask()
function.
Should toTask()
function have the corresponding changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean fromTask
and toTask
functions are used for communication between theia
and a plugin.
If problemMatchers
were added to fromTask
function - should we add some logic to toTask
function?
It makes sense to check that problemMatchers
are not lost at converting from TaskDto
to theia.Task
.
toTask
function is used at resolving a task, for example.
I tried to check it using your extension, but looks like resolveTask()
method is not executed for your custom resolver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added problemMatcher
to the destructured properties of TaskDto to avoid including it in the taskDefinition
. But looking at what VS Code does, I think we shouldn't copy that to the Task at this point. I added the following code to my example project:
It prints the problemMatchers
when resolveTask
is called. I tested that with the following entry in tasks.json
:
{
"version": "2.0.0",
"tasks": [
{
"type": "mytask",
"label": "Foo",
"problemMatcher": "$mymatcher"
}
]
}
When running that task, VS Code shows a message "problemMatchers: []", so the value of the problemMatcher
property is not passed to the task resolver. One reason for this might be that the properties are incompatible in this direction. Here's the description of problemMatcher
in tasks.json:
The problem matcher(s) to use. Can either be a string or a problem matcher definition or an array of strings and problem matchers.
This matches what we have in our TaskCustomization
interface.
When I tried to run that task in Theia, I found another problem (unrelated to this change): the task resolver is not called, or at least I don't see any info message popping up. Is this a known problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test it today and write the results here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I investigated the problem:
- task system resolves a task using registered resolvers
- task service takes the corresponding resolver by task type
- the problem is: the custom task from the extension comes with type
shell
,mytask
type is present astaskType
field in the configuration - as result -
ProcessTaskResolver
is used for resolving the task, not custom resolver from the extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
651853d
to
4d25f75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spoenemann
I commented above:
It makes sense to check that problemMatchers are not lost at converting from TaskDto to theia.Task
because task service resolves a task before running and precisely resolved task configuration is passed to server for running. So I was worried that problemMatchers
can be lost on the resolving step.
I explored code more close and I found that problemMatchers
come on server within TaskConfiguration
and RunTaskOption
objects, but actually task server reads problemMatchers
from RunTaskOption
object. So - regarding my comment above - there are should be no problems with converting task configuration.
Also I added a log and checked that with your changes problemMatchers
come to task server:
I tested according to Steps to reproduce
section of #8755 - it fixes the issue - dialog to pick a problem matcher is NOT shown for the mytask: Print a warning
task.
But I faced with another problem - task system does not display the dialog to pick problem matcher for any detected
task.
Could you check that use case on your side?
4d25f75
to
e0b33c9
Compare
Good catch @RomanNikitenko! I fixed that by checking Could you verify the fix? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface ExtendedTask extends theia.Task2
was added within the PR, but I didn't find the interface on VS Code side.
I think it's better to keep objects close to VS Code implementation.
The interface is used like:
if ((task as ExtendedTask).hasProblemMatchers) {
We could do it like:
if ((task as types.Task).hasProblemMatchers) {
In that case we could avoid adding the additional interface.
wdyt?
Signed-off-by: Miro Spönemann <[email protected]>
e0b33c9
to
5da631a
Compare
Ok changed that. I wasn't aware of If there are no objections, I'll merge this later today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested:
- using test extension from
Steps to reproduce
section of Problem matchers specified by task provider are not respected #8755 - task system doesn't ask about problem matchers at runningmytask: Print a warning
task - for
detected
npm:install
andnpm:build
tasks - task system asks about problem matchers if they are not provided by task provider
I didn't notice any regression.
What it does
Fixes #8755. The
problemMatchers
array from the Task object created by the task provider is copied to theproblemMatcher
field in TaskDto to be transferred to the frontend.Caveat:
problemMatcher
is not yet defined inTaskDto
, but it has a catch-all signature[key: string]: any
. Adding that field explicitly toTaskDto
leads to problems because the type is also used to transfer task data from frontend to backend, and the respective field inTaskCustomization
is not compatible.How to test
See reproduction steps in #8755.
Review checklist
Reminder for reviewers