Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions addons/block_code/ui/script_window/script_window.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@ var script_content: String = ""
@onready var script_label: CodeEdit = %Code


## Attempts to match the syntax highlighting for some open script in the
## editor, which is more likely to be appropriate for the editor theme
## than our hardcoded default
func _apply_editor_syntax_highlighter():
var script_editor: ScriptEditor = EditorInterface.get_script_editor()
for x in script_editor.get_open_script_editors():
var control: Control = x.get_base_editor()
if control is TextEdit:
script_label.syntax_highlighter = control.syntax_highlighter
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

break


func _ready():
_apply_editor_syntax_highlighter()
script_label.text = script_content.replace("\t", " ")


Expand Down