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

Godot4 Editor not picking up external editing changes with LSP #69485

Closed
xdl opened this issue Dec 2, 2022 · 4 comments · Fixed by #69550
Closed

Godot4 Editor not picking up external editing changes with LSP #69485

xdl opened this issue Dec 2, 2022 · 4 comments · Fixed by #69550

Comments

@xdl
Copy link

xdl commented Dec 2, 2022

Godot version

4.0.beta7.official [0bb1e89]

System information

Ubuntu 18.04

Issue description

I believe there is an issue with the Godot editor's script editor not picking up changes whenever a file is changed from an editor that has an LSP integration.

Steps to reproduce

  1. Create a new project in Godot 4.0 (e.g. zz-godot-4-editor-test)
  2. Create a new node (e.g. a Control), attach a script file to it, (e.g. Test.gd).
  3. Add a print("Hello World!") to the _ready function in Test.gd
  4. Run with <F5> and confirm it runs and prints out
  5. Open Test.gd in either Emacs with gdscript-mode enabled (https://github.com/godotengine/emacs-gdscript-mode) or VSCode with godot-tools (https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools), change line to something like print("Hello World from emacs")
  6. Switch back to Godot Editor. Script file does not get updated with the above change
    • The way to get this updated to close the script with <Ctrl-w> and reopen it

The script does reload properly if:

  • The extension is disabled (godot-tools in VSCode/emacs-gdscript-mode in Emacs)
  • The file is edited using an editor without LSP (e.g. Vim)

Performed the above on Ubuntu 18.04 machine with Godot 4 beta7 but I've observed it since first trying out Godot4 which was around beta4.

Having a quick look at open PRs, this one (#66658) looks like it could be relevant but it hasn't been updated for a while.

Minimal reproduction project

extends Control

# Called when the node enters the scene tree for the first time.
func _ready():
	print("Hello World from VSCode")
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	pass
@xdl
Copy link
Author

xdl commented Dec 22, 2022

FYI I just tried reproducing this on the beta9 build (e780dc3) for this on a Windows 10 machine - after editing it in an external LSP-enabled editor I'm getting a dialog popup in the Godot Editor saying the file is newer on disk with the option to reload, which I guess is better (although ideally it'd reload automatically like it does in 3.5.1)?

I have also tried cherrypicking this bugfix #69550 into it but getting the same behaviour.

I'll be able to test it back on the original Ubuntu 18.04 machine again in the new year.

@Rindbee
Copy link
Contributor

Rindbee commented Dec 27, 2022

(although ideally it'd reload automatically like it does in 3.5.1)

You need to enable text_editor/behavior/files/auto_reload_scripts_on_external_change in the editor settings first.

I have also tried cherrypicking this bugfix #69550 into it but getting the same behaviour.

Still out of sync?

@xdl
Copy link
Author

xdl commented Jan 6, 2023

Thanks, I've just tried testing again on beta10:

  • Enabling that option causes it syncs properly on my Windows 10 machine
  • It still gets out of sync on Ubuntu 18.04 even with that option enabled. I'm having issues building on that machine (running into some undeclared fontconfig error) at the moment so can't cherrypick your bugfix into it and re-test unfortunately.

@Rindbee
Copy link
Contributor

Rindbee commented Jan 6, 2023

I feel like you may not be correctly distinguishing between behavior that via lsp and behavior that not.

Display a script in the script editor and edit it in an external editor.

  1. If editing via lsp, the script editor will sync and refresh automatically, not need refocusing godot after saving.
  2. If not via lsp (the connection is disconnected, or an editor that does not support lsp is used), after saving, the script editor will not be synced and refreshed until godot is refocused.

I can't judge your operation from your description.

(running into some undeclared fontconfig error)

If you don't want to get these messages, you may need to install libfontconfig-dev, I'm not sure if it's that name on your system.

I've resolved the conflict, you can retest if it's convenient for you.

@akien-mga akien-mga added this to the 4.0 milestone Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants