From ee8434beb2f3b2281bd932a64b7cbd606847a3ad Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Wed, 5 May 2021 07:59:04 -0400 Subject: [PATCH 1/2] Fix the crash when Autocompletion was triggered on output port of watch node --- .../Search/NodeAutoCompleteSearchViewModel.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs index 1d4e02f1cc3..1037f44b428 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs @@ -157,6 +157,8 @@ internal IEnumerable GetMatchingSearchElements() var core = dynamoViewModel.Model.LibraryServices.LibraryManagementCore; + portType = StripUnwantedStringFromOutputType(portType); + //if inputPortType is an array, use just the typename var parseResult = ParserUtils.ParseWithCore($"dummyName:{ portType};", core); var ast = parseResult.CodeBlockNode.Children().FirstOrDefault() as IdentifierNode; @@ -262,6 +264,16 @@ private bool DerivesFrom(string typea, string typeb, ProtoCore.Core core) } } + private String StripUnwantedStringFromOutputType(String portType) + { + String stringToRemove = "Node Output:"; + + int index = portType.IndexOf(stringToRemove); + portType = index < 0 ? portType : portType.Remove(index, stringToRemove.Length); + + return portType; + } + /// /// Compares NodeSearchElements based on their typeDistance from a given type 'typeNameToCompareTo' /// From 484d2277362d0a75577e2d6625c62f74223a209a Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Thu, 6 May 2021 08:17:05 -0400 Subject: [PATCH 2/2] Change the output port type for the watch node. --- .../Search/NodeAutoCompleteSearchViewModel.cs | 12 ------------ src/Libraries/CoreNodeModels/Watch.cs | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs index 1037f44b428..1d4e02f1cc3 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeAutoCompleteSearchViewModel.cs @@ -157,8 +157,6 @@ internal IEnumerable GetMatchingSearchElements() var core = dynamoViewModel.Model.LibraryServices.LibraryManagementCore; - portType = StripUnwantedStringFromOutputType(portType); - //if inputPortType is an array, use just the typename var parseResult = ParserUtils.ParseWithCore($"dummyName:{ portType};", core); var ast = parseResult.CodeBlockNode.Children().FirstOrDefault() as IdentifierNode; @@ -264,16 +262,6 @@ private bool DerivesFrom(string typea, string typeb, ProtoCore.Core core) } } - private String StripUnwantedStringFromOutputType(String portType) - { - String stringToRemove = "Node Output:"; - - int index = portType.IndexOf(stringToRemove); - portType = index < 0 ? portType : portType.Remove(index, stringToRemove.Length); - - return portType; - } - /// /// Compares NodeSearchElements based on their typeDistance from a given type 'typeNameToCompareTo' /// diff --git a/src/Libraries/CoreNodeModels/Watch.cs b/src/Libraries/CoreNodeModels/Watch.cs index 27f372468d9..8750ac7132c 100644 --- a/src/Libraries/CoreNodeModels/Watch.cs +++ b/src/Libraries/CoreNodeModels/Watch.cs @@ -16,7 +16,7 @@ namespace CoreNodeModels [NodeDescription("WatchNodeDescription", typeof(Resources))] [NodeSearchTags("WatchNodeSearchTags", typeof(Resources))] [IsDesignScriptCompatible] - [OutPortTypes("Node Output: var")] + [OutPortTypes("var")] [AlsoKnownAs("Dynamo.Nodes.Watch", "DSCoreNodesUI.Watch")] public class Watch : NodeModel {