Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2013-08-19 12:16:22 +0400
committerMike Krüger <mkrueger@xamarin.com>2013-08-19 12:16:22 +0400
commit35374c211176cbc6851a37c96a569d4c0ee1dcef (patch)
treebb00802e4c4b06d6af8e227cd9e137d0349bb1c5 /main/src
parentc978884ae0e341a3b14dee507e1af6c1d1511006 (diff)
[Ide] Fixed crash in formatting command when formatter doesn't support
on the fly formatting.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs
index 0cd334897b..602fa04b91 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs
@@ -59,8 +59,12 @@ namespace MonoDevelop.Ide.CodeFormatting
var formatter = CodeFormatterService.GetFormatter (mt);
if (formatter == null)
return;
- using (var undo = doc.Editor.OpenUndoGroup ()) {
- formatter.OnTheFlyFormat (doc, 0, doc.Editor.Length);
+ if (formatter.SupportsOnTheFlyFormatting) {
+ using (var undo = doc.Editor.OpenUndoGroup ()) {
+ formatter.OnTheFlyFormat (doc, 0, doc.Editor.Length);
+ }
+ } else {
+ doc.Editor.Text = formatter.FormatText (doc.Project.Policies, doc.Editor.Text);
}
}
}