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

markers: update the problem-marker decoration #7466

Closed
wants to merge 1 commit into from

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes #3819

The following commit updates the problem-marker decoration from the explorer to display the total count of errors and warnings for a given resource and updates container nodes (parent directories) to display a generic symbol. The following changes are aligned with the behavior with VS Code.

Screen Shot 2020-03-31 at 1 07 39 PM

How to test

  1. register error or warning markers in a given workspace
  2. the explorer should display the updated marker decorations (count or generic badge)

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto [email protected]

Fixes #3819

The following commit updates the `problem-marker` decoration from
the `explorer` to display the total count of errors and warnings for a given resource
and updates container nodes (parent directories) to display a generic symbol. The
following changes are aligned with the behavior with VS Code.

Signed-off-by: vince-fugnitto <[email protected]>
@vince-fugnitto vince-fugnitto added enhancement issues that are enhancements to current functionality - nice to haves markers issues related to problem markers labels Mar 31, 2020
@vince-fugnitto vince-fugnitto self-assigned this Mar 31, 2020
@@ -127,10 +127,14 @@ export class ProblemDecorator implements TreeDecorator {
}

protected toDecorator(marker: Marker<Diagnostic>): TreeDecoration.Data {
// Determine if the given marker is for a resource of a container.
const isResource = Array.from(this.problemManager.getUris()).some(m => m === marker.uri);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if there is a better way to do this.
It'd be easy if I had access to the FileStat and could determine if the marker's URI is a directory or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, do only files have a marker? Folders wouldn't match anything?

You could write const isResource = new Set(this.problemManager.getUris()).has(marker.uri); and document why this test filters file from folders.

I don't see a clean way to get information about the filestat synchronously. Best we could do is make a bunch of modification to get data about the current node being decorated, and see what field we could add to the node (folder etc...)

@vince-fugnitto
Copy link
Member Author

We will need to add a strategy when dealing with multiple tailDecorations in order to enforce a certain order. For example, we want to have markers before scm decorations:

4 M

and not

M 4

@vince-fugnitto
Copy link
Member Author

We also need to merge the decoration for scm and problems for containers (parent nodes).

Copy link
Contributor

@elaihau elaihau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played with this change in my local environment. And I confirm it works as described in both single and multi-root workspace, with both warning and errors in a single file.

@vince-fugnitto
Copy link
Member Author

I played with this change in my local environment. And I confirm it works as described in both single and multi-root workspace, with both warning and errors in a single file.

I'd like to see if we can be able to enforce an order for tailDecorations so that
problems can be before scm. As far as I know, nothing exists as of yet.

@akosyakov
Copy link
Member

Anything else should be done here?

@vince-fugnitto
Copy link
Member Author

Anything else should be done here?

@akosyakov I believe #7466 (comment) is blocking the pull-request at the moment.

@vince-fugnitto vince-fugnitto marked this pull request as draft May 5, 2020 15:26
@vince-fugnitto
Copy link
Member Author

I pushed the changes to my fork and will revisit whenever I have some time: vince-fugnitto#9

@vince-fugnitto vince-fugnitto deleted the vf/GH-3819 branch June 23, 2020 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement issues that are enhancements to current functionality - nice to haves markers issues related to problem markers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[markers] update problem-marker decorators similar to vscode
4 participants