282
282
if (result.CaretEndOffset > e.Offset)
283
283
result.CaretEndOffset += delta;
286
var formatter = CodeFormatterService.GetFormatter (context.Document.Editor.Document.MimeType);
287
if (formatter != null && context.Document.HasProject) {
288
formatter.OnTheFlyFormat (context.Document, 0, data.Length);
291
286
IndentCode (data, context.LineIndent);
292
287
result.Code = data.Text;
436
431
document.Editor.Caret.Location = document.Editor.OffsetToLocation (newoffset) ;
438
/* if (PropertyService.Get ("OnTheFlyFormatting", false)) {
439
string mt = DesktopService.GetMimeTypeForUri (document.FileName);
440
var formatter = MonoDevelop.Ide.CodeFormatting.CodeFormatterService.GetFormatter (mt);
441
if (formatter != null && formatter.SupportsOnTheFlyFormatting) {
442
document.Editor.Document.BeginAtomicUndo ();
443
formatter.OnTheFlyFormat (document.Project != null ? document.Project.Policies : null,
444
document.Editor, offset, offset + length);
445
document.Editor.Document.EndAtomicUndo ();
433
var prettyPrinter = CodeFormatterService.GetFormatter (data.MimeType);
434
if (prettyPrinter != null) {
435
int endOffset = template.InsertPosition + template.Code.Length;
436
var oldVersion = data.Version;
437
prettyPrinter.OnTheFlyFormat (document, template.InsertPosition, endOffset);
438
foreach (var textLink in template.TextLinks) {
439
for (int i = 0; i < textLink.Links.Count; i++) {
440
var segment = textLink.Links [i];
441
var translatedOffset = oldVersion.MoveOffsetTo (data.Version, template.InsertPosition + segment.Offset) - template.InsertPosition;
442
textLink.Links [i] = new TextSegment (translatedOffset, segment.Length);