Posted 16 years ago
by Mike Strobel
-
Software Engineer,
CDC Software

A week or so ago I was working on a DLR language parser/highlighter for the SyntaxEditor alpha. I would create classification ranges based on the ranges of the tokens that I received from the DLR's tokenizer service, but my classification ranges were always several characters off, and I was getting argument out-of-range exceptions. I eventually figured out that the text ranges expected from the classifier were based on the document text using \n line terminators, while the ITextSnapshot's Text property returned the text using \r\n line terminators. This seems a bit odd to me. I was able to get it working by passing the result of GetText(LineTerminator.Newline) to the DLR's tokenizer, but the current design seems a bit counterintuitive. I would think that the Text property would expose the text with the same formatting as is expected by the parser/classifier. Has anyone else run into this issue?
Perhaps Text should return the document text with \n line terminators, and a RawText or OriginalText property should return the text with the document's original line terminators?
[Modified at 02/23/2009 08:43 AM]
Perhaps Text should return the document text with \n line terminators, and a RawText or OriginalText property should return the text with the document's original line terminators?
[Modified at 02/23/2009 08:43 AM]