Getting nodes in ProjectView marked as red when there is problem in file for custom language

Hi,

We have a custom file type where we have provided a TreeStructureProvider to get our custom files to show differently in the project view.

When you have a syntax error in Java-files, you get a red marking in the class (in project view) and in the parent packages. When we have syntax error in our custom language files though, we do not get this marking. I have tried overriding hasProblemFileBeneath() in our tree node (inheriting from BasePsiNode), but it does not work.

Any pointers?

/Marcus

6 comments
Comment actions Permalink

Hello Marcus,

You need to implement a ) and return true for files of your language.

We have a custom file type where we have provided a
TreeStructureProvider to get our custom files to show differently in
the project view.

When you have a syntax error in Java-files, you get a red marking in
the class (in project view) and in the parent packages. When we have
syntax error in our custom language files though, we do not get this
marking. I have tried overriding hasProblemFileBeneath() in our tree
node (inheriting from BasePsiNode), but it does not work.

Any pointers?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Am I missing something, or is the display wrong? Here's what your reply looks like on my machine (Firefox 3.5 on Linux). What does he need to implement??? a ) ?
notes2.png

0
Comment actions Permalink

Hello WarnerJan,

Sorry, the forum ate my XML. The extension is called problemFileHighlightFilter
and it needs to implement the Condition of VirtualFile.

Am I missing something, or is the display wrong? Here's what your
reply looks like on my machine (Firefox 3.5 on Linux). What does he
need to implement??? a ) ?


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


1
Comment actions Permalink

I tried this, but cannot get the callback to work. I see that the groovy plugin does exactly this in the community version of IDEA, but not in Version 8.

Is this a version 9 only feature? Any version 8 workarounds?

/Marcus

0
Comment actions Permalink

Hello Marcus,

In IDEA 8, you can use the explicit registration API instead of an extension
point: WolfTheProblemSolver.getInstance().registerFileHighlightFilter()

I tried this, but cannot get the callback to work. I see that the
groovy plugin does exactly this in the community version of IDEA, but
not in Version 8.

Is this a version 9 only feature? Any version 8 workarounds?

/Marcus

---
Original message URL:
http://www.jetbrains.net/devnet/message/5252141#5252141

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

That worked, thanks!

I had to do the following to get red marking in my ProjectViewNode that I am using to represent the file:

public TextAttributesKey getTextAttributesKey()
    {
        WolfTheProblemSolver theProblemSolver = WolfTheProblemSolver.getInstance(element.getProject());
        if (theProblemSolver.isProblemFile(element.getContainingFile().getVirtualFile()))
        {
            return CodeInsightColors.ERRORS_ATTRIBUTES;
        }

        return null;
    }

This is a method of the ItemPresentation used for the ProjectViewNode. It works, but it there a more implicit way to say that my ProjectViewNode should be marked on error?

0

Please sign in to leave a comment.