godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.52k stars 149 forks source link

Implement automatic creation of func #501

Closed magian1127 closed 9 months ago

magian1127 commented 10 months ago

Implemented GDS auto method creation in VSCode together with https://github.com/godotengine/godot/pull/82996 . Later, C# can also use a similar approach for auto method creation in VSCode .

atirut-w commented 10 months ago

Can you leave in a summary of what this does?

magian1127 commented 10 months ago

Because there are two PR, haven't had time to write explanations yet.

DaelonSuzuka commented 10 months ago

What is "auto method creation"? You still haven't explained what either of these PRs actually does.

magian1127 commented 10 months ago

https://github.com/godotengine/godot-vscode-plugin/assets/14800320/71eb6375-7205-43fa-a6fd-19f7c330bf05

DaelonSuzuka commented 10 months ago

This is something that the Godot editor already does entirely on its own. I don't see a reason why VSCode needs to be involved.

magian1127 commented 10 months ago

During Godot 3.x, it was also achieved using the built-in LSP message workspace/applyEdit in VSCode. Of course, it can be done independently within the Godot editor, but that would create many issues. For instance, if an external editor is actively editing a file and has not been saved yet, allowing GODOT to directly modify it would result in conflicts. Therefore, the sensible approach is for GDS to send an LSP message, and then the external editor can process it using the corresponding method based on the LSP message.

godot 3.x 的时候也是靠 VSCode 中内置的 LSP 消息 workspace/applyEdit 完成的. 当然可以在 godot 编辑器 中独立完成,但是会产生很多问题. 比如外部编辑器正在编辑文件, 还没有保存, 如果让 GODOT 直接修改,会产生冲突. 所以合理的做法, 就是 GDS 发送 LSP 消息,之后外部编辑器根据 LSP 消息用对应方法处理.