rsdn / nitra

Nitra is a language workbench

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[VS Plugin] Some error messages are not displayed

ssrmm opened this issue · comments

commented

Some of the produced error messages are not shown in Visual Studio. Consider the following example with the C# grammar

namespace CSharp
{
    public class Program
    {}
    
    public class Program
    {}
    
    public class Tester
    {
        public Program Test()
        {
            throw new System.NotImplementedException();
        }
    }
}

Inside Visual Studio this produces only one error message:

Symbol 'Program' is ambiguous.

In the visualizer however the same program and the same grammar produce a total of 8 errors:

Visualizer Errors

That means currently only error message 3 is shown in VisualStudio. However, error messages 1, 2, 4 and 5 should also be displayed. Messages 6, 7 and 8 seem to be a minor bug in the grammar or the visualizer and shouldn't be relevant for this.

The problem is that VS interface is not designed to display hierarchy of errors. We can show it in hints and as separate records in the Error window.
It looks bad:
image

commented

Yeah, I guess it doesn't make much sense when the sub-errors appear out of context. I'm pretty sure I've seen VS do something similar in one case, but really can't remember what it was...

The Redefinition of 'Program' should be displayed, though.

I try to set MaintainInitialTaskOrder property of the ErrorListProvider, but in has no effect.
The VS Error list does not call IVsTaskProvider2.MaintainInitialTaskOrder() and always use sorting. :(
I think that under these conditions, show nested messages in the Error list does not make sense.

Apparently I have to change the whole design.
I should make one message which include all information. And to make navigation through a pop up hint.
Too much work. :(

I solved this problem by improve the hint and the error message.
Screenshot