godot-vscode-plugin icon indicating copy to clipboard operation
godot-vscode-plugin copied to clipboard

Option to prevent connecting to Godot editor

Open ithinkandicode opened this issue 3 years ago • 5 comments

Godot version

3.5-stable

VS Code version

1.72.2

Godot Tools VS Code extension version

1.3.1

System information

Window 10

Problem statement

This notices popups up if you aren't running Godot:

Couldn't connect to the GDScript language server at 127.0.0.1:6008. Is the Godot editor running?

I only want to use the syntax highlighting feature of this extension, so is there a way to prevent it from trying to connect to the editor every time?

I'm aware of #356 but the fix was to run Godot, which isn't a viable fix for this situation

Proposed solution

Add an option to prevent trying to connect to the editor

ithinkandicode avatar Nov 02 '22 19:11 ithinkandicode

I like this idea. I'll probably add a "don't bother me again" button to the popup, and an option in the extension settings.

Thanks for the suggestion.

DaelonSuzuka avatar Nov 03 '22 05:11 DaelonSuzuka

I'll probably add a "don't bother me again" button to the popup

This sounds too easy to accidentally activate, especially if it applies globally and not on a per-folder basis.

Calinou avatar Nov 03 '22 16:11 Calinou

This sounds too easy to accidentally activate, especially if it applies globally and not on a per-folder basis.

That's definitely possible. I was planning to play around with it. Maybe it could be a "don't bother me again today", or "don't bother me again this session" without risking getting stuck. Also, thanks to oidro's great PR fixing all the settings names, I now know how to save state per-workspace, so maybe "don't bother me again today, for this workspace" could be sufficiently "safe".

DaelonSuzuka avatar Nov 29 '22 23:11 DaelonSuzuka

We should probably make it so the setting ignores connection errors, rather than disabling the connection entirely even if it could work.

Calinou avatar Apr 07 '23 16:04 Calinou

Agree. Also, I think changing the popup buttons is not strictly necessary, as settings can already be applied per-workspace if desired (you could just add a text like "This warning can be disabled in settings." to the popup). So a setting like proposed should be enough:

/** Disable the popup warning when all connection attempts at startup fail. */
"godotTools.warnUnableToConnect": false, // default true

The setting should be considered only at startup, it should be ignored if you clicked Retry.

By the way, when trying to find workarounds for this using the existing settings, here's what happened:

"godot_tools.reconnect_attempts": 0, // tried to connect 11 times (10+1), instead of just once
"godot_tools.reconnect_attempts": -1, // immediate warning; presumably tried to connect once, instead of 0
"godot_tools.gdscript_lsp_server_port": -1, // stuck on "Initializing" forever; clicking it shows popup:
// "Connecting to the GDScript language server at 127.0.0.1:-1" so it seems there's no validation of port

The only workaround at the moment that somewhat works is like mentioned:

"godot_tools.reconnect_cooldown": 999999999, // tries to connect once (presumably); wait forever-ish to retry
// the popup won't show until after at least a million seconds

AlfishSoftware avatar Apr 07 '23 18:04 AlfishSoftware