Skip to content

Commit

Permalink
Fix autocompletion in 4.3
Browse files Browse the repository at this point in the history
This is a bit annoying but it works.
  • Loading branch information
Jowan-Spooner committed Aug 14, 2024
1 parent 8621814 commit b0f0725
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,16 @@ func confirm_code_completion(replace:bool, text:CodeEdit) -> void:
word = get_code_completion_parameter_value(text)

text.remove_text(text.get_caret_line(), text.get_caret_column()-len(word), text.get_caret_line(), text.get_caret_column())
text.set_caret_column(text.get_caret_column()-len(word))

# Something has changed between 4.2 and 4.3
# Probably about how carets are reset when text is removed or idk.
# To keep compatibility with 4.2 for at least a while this should do the trick:
# TODO: Remove once compatibility for 4.2 is dropped.
if Engine.get_version_info().hex >= 0x040300:
text.set_caret_column(text.get_caret_column())
else:
text.set_caret_column(text.get_caret_column()-len(word))

text.insert_text_at_caret(code_completion.insert_text)

if code_completion.has('default_value') and typeof(code_completion['default_value']) == TYPE_STRING:
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Modules/Call/event_call.gd
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func get_method_suggestions(filter:String="", temp_autoload:String = "") -> Dict
var suggestions := {}

var script: Script
if temp_autoload:
if temp_autoload and ProjectSettings.has_setting('autoload/'+temp_autoload):
script = load(ProjectSettings.get_setting('autoload/'+temp_autoload).trim_prefix('*'))

elif autoload_name and ProjectSettings.has_setting('autoload/'+autoload_name):
Expand Down

0 comments on commit b0f0725

Please sign in to comment.