diff options
author | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@xamarin.com> | 2015-04-20 19:07:51 +0300 |
commit | 95408b1a41b31b645f3a8c3323ab7d3ca4bff26b (patch) | |
tree | f8f137cddcb9a40499d303be95722fd2c6081bce /main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs | |
parent | b70e4e04b4e41b8ec28d7e4b220b401ecf467e7a (diff) | |
parent | de043d330a8bf5855d4d983c804cd36727cb2406 (diff) |
Merge remote-tracking branch 'origin/roslyn' into new-project-model
Diffstat (limited to 'main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs')
-rw-r--r-- | main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs b/main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs index 1e7d7dca23..9c779f2a55 100644 --- a/main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs +++ b/main/src/addins/AspNet/WebForms/SuggestedHandlerCompletionData.cs @@ -32,24 +32,25 @@ using MonoDevelop.Core; using MonoDevelop.Projects; using MonoDevelop.Ide.CodeCompletion; using MonoDevelop.DesignerSupport; -using ICSharpCode.NRefactory.TypeSystem; using System.Linq; +using MonoDevelop.Ide.Editor.Extension; +using Microsoft.CodeAnalysis; namespace MonoDevelop.AspNet.WebForms { class SuggestedHandlerCompletionData : CompletionData { - readonly Project project; + readonly MonoDevelop.Projects.Project project; readonly CodeMemberMethod methodInfo; - readonly IType codeBehindClass; - readonly IUnresolvedTypeDefinition codeBehindClassPart; + readonly INamedTypeSymbol codeBehindClass; + readonly Location codeBehindClassLocation; - public SuggestedHandlerCompletionData (Project project, CodeMemberMethod methodInfo, IType codeBehindClass, IUnresolvedTypeDefinition codeBehindClassPart) + public SuggestedHandlerCompletionData (MonoDevelop.Projects.Project project, CodeMemberMethod methodInfo, INamedTypeSymbol codeBehindClass, Location codeBehindClassLocation) { this.project = project; this.methodInfo = methodInfo; this.codeBehindClass = codeBehindClass; - this.codeBehindClassPart = codeBehindClassPart; + this.codeBehindClassLocation = codeBehindClassLocation; } public override IconId Icon { @@ -74,22 +75,21 @@ namespace MonoDevelop.AspNet.WebForms } } - public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier) + public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, KeyDescriptor descriptor) { //insert the method name - MonoDevelop.Ide.Gui.Content.IEditableTextBuffer buf = window.CompletionWidget as MonoDevelop.Ide.Gui.Content.IEditableTextBuffer; + var buf = window.CompletionWidget; if (buf != null) { - using (var undo = buf.OpenUndoGroup ()) {
- buf.DeleteText (window.CodeCompletionContext.TriggerOffset, buf.CursorPosition - window.CodeCompletionContext.TriggerOffset); - buf.InsertText (buf.CursorPosition, methodInfo.Name); - }
+ buf.Replace (window.CodeCompletionContext.TriggerOffset, buf.CaretOffset - window.CodeCompletionContext.TriggerOffset, methodInfo.Name); } //generate the codebehind method - if (codeBehindClassPart != null && project != null) - BindingService.AddMemberToClass (project, codeBehindClass.GetDefinition (), codeBehindClassPart, methodInfo, false); - else - BindingService.AddMemberToClass (project, codeBehindClass.GetDefinition (), codeBehindClass.GetDefinition ().Parts.First (), methodInfo, false); + + // TODO: Roslyn port. +// if (codeBehindClassLocation != null && project != null) +// BindingService.AddMemberToClass (project, codeBehindClass, codeBehindClassLocation, methodInfo, false); +// else +// BindingService.AddMemberToClass (project, codeBehindClass, codeBehindClass.Locations.First (), methodInfo, false); } } } |