diff --git a/src/DynamoCoreWpf/UI/Resources/DesignScript.Resources.SyntaxHighlighting.xshd b/src/DynamoCoreWpf/UI/Resources/DesignScript.Resources.SyntaxHighlighting.xshd
index ce500a87ca6..8c72d2e0987 100644
--- a/src/DynamoCoreWpf/UI/Resources/DesignScript.Resources.SyntaxHighlighting.xshd
+++ b/src/DynamoCoreWpf/UI/Resources/DesignScript.Resources.SyntaxHighlighting.xshd
@@ -39,16 +39,16 @@
"
-
+
-
+
-
+
@@ -58,7 +58,7 @@
-
+
@@ -72,7 +72,7 @@
-
+
@@ -96,7 +96,7 @@
-
+
diff --git a/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockEditorUtils.cs b/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockEditorUtils.cs
index 29933f99c20..133489a90f9 100644
--- a/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockEditorUtils.cs
+++ b/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockEditorUtils.cs
@@ -1,10 +1,11 @@
-using System;
+using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Media;
using System.Xml;
using Dynamo.Configuration;
using Dynamo.Engine;
+using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using ICSharpCode.AvalonEdit.Rendering;
@@ -132,19 +133,30 @@ public static void CreateHighlightingRules(ICSharpCode.AvalonEdit.TextEditor edi
var stream = typeof(CodeHighlightingRuleFactory).Assembly.GetManifestResourceStream(
"Dynamo.Wpf.UI.Resources." + Configurations.HighlightingFile);
+ // Hyperlink color
+ editor.TextArea.TextView.LinkTextForegroundBrush = new SolidColorBrush(Color.FromArgb(255, 106, 192, 231));
+
editor.SyntaxHighlighting = HighlightingLoader.Load(
new XmlTextReader(stream), HighlightingManager.Instance);
+ AddCommonHighlighingRules(editor, controller);
+ }
+
+ // Assigning custom highlighting rules moved to a separate method
+ // So we can reuse for both design script and python script
+ // Allows each individual eidtor to have their own set of rules, and aligns the common ones
+ internal static void AddCommonHighlighingRules(TextEditor editor, EngineController controller)
+ {
// Highlighting Digits
var rules = editor.SyntaxHighlighting.MainRuleSet.Rules;
rules.Add(CodeHighlightingRuleFactory.CreateNumberHighlightingRule());
-
+
var classRule = CodeHighlightingRuleFactory.CreateClassHighlightRule(controller);
- if(classRule != null) rules.Add(classRule);
+ if (classRule != null) rules.Add(classRule);
var methodRule = CodeHighlightingRuleFactory.CreateMethodHighlightRule(controller);
- if(methodRule != null) rules.Add(methodRule);
+ if (methodRule != null) rules.Add(methodRule);
}
}
}
diff --git a/src/DynamoCoreWpf/Views/CodeCompletion/CodeCompletionEditor.xaml.cs b/src/DynamoCoreWpf/Views/CodeCompletion/CodeCompletionEditor.xaml.cs
index bb1a40abe70..ec90933de1c 100644
--- a/src/DynamoCoreWpf/Views/CodeCompletion/CodeCompletionEditor.xaml.cs
+++ b/src/DynamoCoreWpf/Views/CodeCompletion/CodeCompletionEditor.xaml.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@@ -418,4 +418,4 @@ internal void Dispose()
this.dynamoViewModel.PreferencesViewModel.PropertyChanged -= OnPreferencesViewModelPropertyChanged;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Libraries/PythonNodeModelsWpf/Resources/ICSharpCode.PythonBinding.Resources.Python.xshd b/src/Libraries/PythonNodeModelsWpf/Resources/ICSharpCode.PythonBinding.Resources.Python.xshd
index 4e76c821f65..596782a2614 100644
--- a/src/Libraries/PythonNodeModelsWpf/Resources/ICSharpCode.PythonBinding.Resources.Python.xshd
+++ b/src/Libraries/PythonNodeModelsWpf/Resources/ICSharpCode.PythonBinding.Resources.Python.xshd
@@ -18,27 +18,27 @@
-
+
()[]{}@,:.`=;+-*/% &|^><
-
+
'
'
-
+
"""
"""
-
+
#
-
+
"
"
-
- (
-
+
+ (
+
@@ -46,51 +46,55 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
diff --git a/src/Libraries/PythonNodeModelsWpf/ScriptEditorWindow.xaml.cs b/src/Libraries/PythonNodeModelsWpf/ScriptEditorWindow.xaml.cs
index a8d507d2daa..7374f0bd968 100644
--- a/src/Libraries/PythonNodeModelsWpf/ScriptEditorWindow.xaml.cs
+++ b/src/Libraries/PythonNodeModelsWpf/ScriptEditorWindow.xaml.cs
@@ -20,6 +20,8 @@
using System.Text.RegularExpressions;
using System.Windows.Media;
using Dynamo.PythonServices;
+using Dynamo.Wpf.Views;
+using System.Windows.Media;
using ICSharpCode.AvalonEdit;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
@@ -129,6 +131,9 @@ internal void Initialize(Guid workspaceGuid, Guid nodeGuid, string propName, str
// Initialize editor with global settings for show/hide tabs and spaces
editText.Options = dynamoViewModel.PythonScriptEditorTextOptions.GetTextOptions();
+ // Hyperlink color
+ editText.TextArea.TextView.LinkTextForegroundBrush = new SolidColorBrush(Color.FromArgb(255, 106, 192, 231));
+
// Set options to reflect global settings when python script editor in initialized for the first time.
editText.Options.ShowSpaces = dynamoViewModel.ShowTabsAndSpacesInScriptEditor;
editText.Options.ShowTabs = dynamoViewModel.ShowTabsAndSpacesInScriptEditor;
@@ -144,6 +149,9 @@ internal void Initialize(Guid workspaceGuid, Guid nodeGuid, string propName, str
editText.SyntaxHighlighting = HighlightingLoader.Load(
new XmlTextReader(elem), HighlightingManager.Instance);
+ // Add custom highlighting rules consistent with DesignScript
+ CodeHighlightingRuleFactory.AddCommonHighlighingRules(editText, dynamoViewModel.EngineController);
+
AvailableEngines =
new ObservableCollection(PythonEngineManager.Instance.AvailableEngines.Select(x => x.Name));
// Add the serialized Python Engine even if it is missing (so that the user does not see an empty slot)
@@ -402,6 +410,7 @@ private void UpdateScript(string scriptText)
dynamoViewModel.ExecuteCommand(command);
this.Focus();
nodeWasModified = true;
+ IsSaved = true;
NodeModel.OnNodeModified();
}