MEF编辑器扩展:错误Squiggles不显示 [英] MEF Editor Extension: Error Squiggles do not show up

查看:103
本文介绍了MEF编辑器扩展:错误Squiggles不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在为自定义语言开发编辑器扩展程序。我有一个解析器用于我的语言,我已按照这个
示例开始用我的编辑器扩展。到目前为止很好:)我可以为关键字着色并为当前行上的错误添加错误曲线。

I am developing an editor extension for a custom language. I have a parser for my language and I have followed this example to start with my editor extension. So far fine:) I can colorize keywords and add error squiggles for errors on the current line.

现在,我的挑战是为非当前行上的错误添加错误标记。结果如下:

Now, my challenge is to add error tag also for errors that are NOT on the current line. Here is how it goes:

1。我的用户遇到了新的错误。从解析器中正确收集所有错误。 (每次调用TokenTagger GetTags方法时都会解析整个文本和错误集合)

1. New error is made my user. All errors are correctly collected from the parser. (parsing of whole text and error collection happens each time TokenTagger GetTags method is called)

2。 TokenTagger正确地将TokenTags添加到正确的位置(关键字,注释和错误)

2. TokenTagger correctly adds TokenTags to right places (keywords, comments and errors)

3。调用ErrorTagger。这是我的GetTags方法

3. ErrorTagger is called. This is my GetTags method

 


public IEnumerable<ITagSpan<IErrorTag>> GetTags(NormalizedSnapshotSpanCollection spans)
{
            foreach (var tagSpan in this.myTagAggregator.GetTags(spans)) 
            {
                if (tagSpan.Tag.type == TokenTypes.Other)
                {
                    var tagSpans = tagSpan.Span.GetSpans(spans[0].Snapshot);
                    string message = tagSpan.Tag.errorMessage;
                    string type = tagSpan.Tag.errorType;

                    yield return
                        new TagSpan<IErrorTag>(tagSpans[0], new ErrorTag(type, message));
                }
            }
}

推荐答案


Hello,

感谢您的提问。

我试图让某人熟悉这个话题进一步看看这个问题。可能会有一些时间延迟。感谢您的耐心。

感谢您的理解和支持。

Yi


这篇关于MEF编辑器扩展:错误Squiggles不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆