Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Format Razor Code Documents based on ContentType. Buffers, Spans, and Snapshots, "Oh My!"

$
0
0


It would be nice to parse the information from the content types and relate them to the lines in the document so that I could add some extra spacing for my graphics above and below the Razor Sections(embedded between conditional flows). 

Example of how I need to parse my code in order for the next formatting step. 

<------------------------- Razor --------------------> 

 Some Razor Output here

<------------------------- Razor -------------------->

<------------------------- CSharp -------------------->

foreach(var str in someStrings) { 

var trimmed = str.Trim();

</-------------------------  CSharp  -------------------->

<------------------------- Razor -------------------->

@:  Some more @(RazorStuff)

@:  Some more @(RazorStuff)

@:  Some more @(RazorStuff)

@:  Some more @(RazorStuff) 

</------------------------- Razor -------------------->

<-------------------------  CSharp  -------------------->

}

</-------------------------  CSharp -------------------->

I am using entity framework to try to discover some of this information with some of the given extension points of MEF. 

IWpfTextView, ITextBuffer, IClassification, etc... But, I haven't figured out how to parse the information in a reliable way as of yet. 

Also, it is my understanding that a TextBuffer is sometimes fed by a number of other TextBuffers using a IProjectBuffer. This is described in the Project seciton of the Inside the Editor documentation on msdn. It would be nice to add another TextBuffer(newly created) to the SourceBuffers collection of a IProjectionBuffer and target it with my template code. That way I could keep track of the information rather than discovering it otherwise. 

Any discussion or ideas would be greatly useful to me. Thanks!


jwize



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>