Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript failed to parse code_edit.gd because of new Godot 4.3 multicaret editing feature #588

Closed
ProFiLeR4100 opened this issue Jun 9, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ProFiLeR4100
Copy link

ProFiLeR4100 commented Jun 9, 2024

Describe the bug

CodeEdit class has changed signature of insert_text function in godot 4.3 in order to support multiple carret editing feature.

Affected version

  • Dialogue Manager version: v2.39.1 (latest)
  • Godot version: v4.3.beta1.mono.official [a4f2ea91a]

To Reproduce

Steps to reproduce the behavior:

  • Install 4.3-beta1 release from preview builds download page
  • Create project
  • Install and enable latest Godot Dialogue Manager addon
  • Check editor notifications
res://addons/dialogue_manager/components/code_edit.gd:280 - Parse Error: The function signature doesn't match the parent. Parent signature is "insert_text(String, int, int, bool = <default>, bool = <default>) -> void".
modules/gdscript/gdscript.cpp:2943 - Failed to load script "res://addons/dialogue_manager/components/code_edit.gd" with error "Parse error". (User)

Expected behavior

Well, I expect it not to crash 😄

Workaround (patch)

I changed the signature to be similar to the parent's.
Not sure what the purpose of new parameters, but multicarret editing is working even with old function body.

Index: addons/dialogue_manager/components/code_edit.gd
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/addons/dialogue_manager/components/code_edit.gd b/addons/dialogue_manager/components/code_edit.gd
--- a/addons/dialogue_manager/components/code_edit.gd	(revision 9c68242a0f9dfc747692e609ec953d5ef9e238de)
+++ b/addons/dialogue_manager/components/code_edit.gd	(date 1717929925474)
@@ -276,7 +276,7 @@
 
 # Insert text at current caret position
 # Move Caret down 1 line if not => END
-func insert_text(text: String) -> void:
+func insert_text(text: String, p_line: int, p_column: int, p_before_selection_begin: bool = true, p_before_selection_end: bool = false) -> void:
 	if text != "=> END":
 		insert_text_at_caret(text+"\n")
 		set_caret_line(get_caret_line()+1)
@xchrix
Copy link
Contributor

xchrix commented Jun 9, 2024

I suffer this bug if I use the addon from assertlib, but if I use the addon from the git repo, the bug disappear.

Version with bug:

  • Dialogue Manager Version: 2.39.1 from Assetlib
  • Godot Version: 4.3.beta1

Version without bug:

  • Dialogue Manager Version: 9f41dc9a6073a388a1c95e36a02fd9f29731ea56 from GitHub
  • Godot Version: 4.3.beta1

@ProFiLeR4100
Copy link
Author

ProFiLeR4100 commented Jun 9, 2024

@xchrix Looks like you are correct.
Version from GitHub uses insert_text_at_cursor and version from AssetLib uses insert_text
image

@ProFiLeR4100
Copy link
Author

ProFiLeR4100 commented Jun 9, 2024

First I've thought that Nathan is overriding base method, but looks like it was the opposite.

So basically @nathanhoad need to deploy new release to AssetLib in order to fix this issue, because actual fix is already provided in next commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants