Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 1c663b0

Browse files
fix #336: Implement interface in code-behind .xaml.cs tries to insert interface implementation in .xaml file
1 parent 1bdd80e commit 1c663b0

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/EditorScript.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using ICSharpCode.NRefactory.Editor;
3131
using ICSharpCode.NRefactory.TypeSystem;
3232
using ICSharpCode.SharpDevelop;
33+
using ICSharpCode.SharpDevelop.Dom;
3334
using ICSharpCode.SharpDevelop.Editor;
3435

3536
namespace CSharpBinding.Refactoring
@@ -188,7 +189,13 @@ public override Task<Script> InsertWithCursor(string operation, ITypeDefinition
188189
var tcs = new TaskCompletionSource<Script>();
189190
if (parentType == null)
190191
return tcs.Task;
191-
var part = parentType.Parts.FirstOrDefault ();
192+
IUnresolvedTypeDefinition part = null;
193+
194+
foreach (var p in parentType.Parts) {
195+
if (part == null || EntityModelContextUtils.IsBetterPart(p, part, ".cs"))
196+
part = p;
197+
}
198+
192199
if (part == null)
193200
return tcs.Task;
194201

0 commit comments

Comments
 (0)