Hi,
I'm developing a VSIX plug-in. I have a custom project which supports some custom files. I have provided my custom syntax highlighting for files of my extension using the IViewTaggerProvider and ITagger<ClassificationTag> interfaces. My code also highlights
multi-line comments.
However, I've noticed that if my multi-line comments span more than what is visible in the editor, then the multi-comments do not highlight correctly. While implementing ITagger<ClassificationTag> interface I had to implement a GetTags(NormalizedSnapshotSpanCollection
spans) method. This method on each key-press would give me all the text that is visible in the editor (in the snapshot). This works fine for everything except when one multi-line comment in my source would span beyond what is visible in the editor.
This problem can be solved by parsing the whole file. But I found that to be inefficient as there was a significant slowdown for large files (>~1000 lines). How do I handle such long multi-line comments without parsing the whole file?
I tried writing a long multi-line comment in a C# file. It did highlight correctly. And, also there was not much of a slowdown for a large C# file. How has C# handled it? Is there a different way to provide syntax highlighting for custom file types other than
ITagger and IViewTaggerProvider? I have been struggling with this for days now. Please, help.