示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UvssClassifier"/> class.
 /// </summary>
 /// <param name="registry">The classification registry.</param>
 /// <param name="parserService">The UVSS language parser service.</param>
 /// <param name="buffer">The text buffer that contains the text being classified.</param>
 internal UvssClassifier(IClassificationTypeRegistryService registry, ITextBuffer buffer)
 {
     this.registry = registry;
     this.buffer   = UvssTextBuffer.ForBuffer(buffer);
     this.buffer.CommentSpanInvalidated += (obj, span) =>
                                           RaiseClassificationChanged(new SnapshotSpan(this.buffer.Buffer.CurrentSnapshot, span));
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SyntaxErrorTagger"/> class.
        /// </summary>
        /// <param name="buffer">The text buffer that contains the text being tagged.</param>
        public SyntaxErrorTagger(ITextBuffer buffer)
        {
            this.buffer = UvssTextBuffer.ForBuffer(buffer);
            this.buffer.CommentSpanInvalidated += (obj, span) =>
                                                  RaiseTagsChanged(new SnapshotSpan(this.buffer.Buffer.CurrentSnapshot, span));

            this.buffer.Parser.DocumentParsed += (sender, e) =>
            {
                UvssTextParserResult mostRecentDocument;
                this.buffer.Parser.GetMostRecent(out mostRecentDocument);
                RaiseTagsChanged(new SnapshotSpan(mostRecentDocument.Snapshot, 0, mostRecentDocument.Snapshot.Length));
            };
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorList"/> class.
        /// </summary>
        /// <param name="serviceProvider">The Visual Studio service provider.</param>
        /// <param name="textDocument">The text document to which this error list belongs.</param>
        public ErrorList(
            IServiceProvider serviceProvider,
            ITextDocument textDocument)
        {
            this.serviceProvider = serviceProvider;

            this.errorListProvider = new ErrorListProvider(serviceProvider);

            this.textDocument = textDocument;
            this.textBuffer   = UvssTextBuffer.ForBuffer(textDocument.TextBuffer);
            this.textBuffer.Parser.DocumentParsed += (sender, e) =>
            {
                var mostRecentResult = default(UvssTextParserResult);
                this.textBuffer.Parser.GetMostRecent(out mostRecentResult);
                OnDocumentGenerated(mostRecentResult);
            };
        }