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
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@novell.com>2010-08-04 11:39:03 +0400
committerMike Krüger <mkrueger@novell.com>2010-08-04 11:39:03 +0400
commit7ce77d5ba4745fdd43444e8708b891a5210a9eea (patch)
treeb611854df8bc8c15ab87ef2c76a1fa919e9a5889 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates
parent98a4a1c95d476e2428d090a032f2f317a24a6d44 (diff)
Fixed 'Bug 626837 - Template expansion invalid when Tabs/Spaces settings are changed'.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs5
2 files changed, 6 insertions, 4 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
index c627598c3e..fbfc339ad0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
@@ -209,7 +209,8 @@ namespace MonoDevelop.Ide.CodeTemplates
TemplateResult result = new TemplateResult ();
StringBuilder sb = new StringBuilder ();
int lastOffset = 0;
- string code = context.TemplateCode;
+ string code = context.Document.Editor.FormatString (context.InsertPosition, context.TemplateCode);
+
result.TextLinks = new List<TextLink> ();
foreach (Match match in variableRegEx.Matches (code)) {
string name = match.Groups[1].Value;
@@ -364,7 +365,7 @@ namespace MonoDevelop.Ide.CodeTemplates
Document = document,
ProjectDom = dom,
ParsedDocument = doc,
- InsertPosition = new DomLocation (data.Caret.Line + 1, data.Caret.Column + 1),
+ InsertPosition = data.Caret.Location,
LineIndent = data.Document.GetLineIndent (data.Caret.Line),
TemplateCode = IndentCode (Code, document.Editor.EolMarker, data.Document.GetLineIndent (data.Caret.Line))
};
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs
index 47063eee26..57fdcfcc6d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/ExpansionObject.cs
@@ -34,6 +34,7 @@ using MonoDevelop.Projects.Dom;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.Projects.Dom.Output;
using Mono.TextEditor.PopupWindow;
+using Mono.TextEditor;
namespace MonoDevelop.Ide.CodeTemplates
{
@@ -53,7 +54,7 @@ namespace MonoDevelop.Ide.CodeTemplates
set;
}
- public DomLocation InsertPosition {
+ public DocumentLocation InsertPosition {
get;
set;
}
@@ -183,7 +184,7 @@ namespace MonoDevelop.Ide.CodeTemplates
if (CurrentContext.ParsedDocument == null)
return fullTypeName;
- return CurrentContext.ParsedDocument.CompilationUnit.ShortenTypeName (new DomReturnType (fullTypeName), CurrentContext.InsertPosition).FullName;
+ return CurrentContext.ParsedDocument.CompilationUnit.ShortenTypeName (new DomReturnType (fullTypeName), CurrentContext.InsertPosition.Line + 1, CurrentContext.InsertPosition.Column + 1).FullName;
}
static Regex functionRegEx = new Regex ("([^(]*)\\(([^(]*)\\)", RegexOptions.Compiled);