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

Do not start the server if i provide a TCP port, Sublime is a Client, not a Server starter #2214

Closed
ryuukk opened this issue Mar 4, 2023 · 6 comments

Comments

@ryuukk
Copy link
Contributor

ryuukk commented Mar 4, 2023

When i provide the "tcp_port", sublime text will not connect to the server, instead it'll start the server

To Reproduce

app.zip

Sample server, it only start a TCP server on port 6969

Use this config:

		"mine": {
			"enabled": true,
			"tcp_port": 6969,
			//"command": ["c:\\dev\\kdom\\projects\\lsp\\app.exe"],
			"selector": "source.d",
			"settings": {
			},
		}

if i comment the "command" i get this error btw:

image

Expected behavior

Sublime Text should initiate a TCP connection to my already open server

It should not start the server

Environment (please complete the following information):

  • OS: Windows 10 x64
  • Sublime Text version: 4143
  • LSP version: 1.22.0
  • Language servers used: mine, provided above

Additional context

Use cases:

  • Compiler server that manages its own language server
  • Easier to debug as a whole since i manage server lifetime completely
  • language server (compiler server) that lives in my server and clients, i can close sublime windows freely
@ryuukk
Copy link
Contributor Author

ryuukk commented Mar 4, 2023

Possible solution:

  • if user provide "tcp_port" without "command", then sublime should skip process startup, and just communicate using provided port with TCP

@rwols
Copy link
Member

rwols commented Mar 4, 2023

I agree this would be nice to have.

@weckr
Copy link
Contributor

weckr commented Jul 16, 2023

+1 for me, i use this with godot, and the editor (and so lsp) is always running when i code by the nature of the work, dont really want sublime to mess with it. That would even be tolerable but for some reason the plugin is spinning one core to 100 percent continuously. Ive tried to give it random dummy shell command like ls or something so it would let me use the lsp, and the lsp with the tcp port filled in actually works like this, but again it spins the core making it really annoying on laptop in summer...
I might look into this myself, since its python. It would be what, just checking if tcp-port setting is present and then ignoring the missing command setting and execution?

edit: ok so apparently the old way through nc still works correctly, only without the tcp sublime setting, otherwise it spins the cpu... would be nice to not to have to use that, but ill take it. maybe it will be helpful to someone here. looked at the code and thats bit too heavy for me to editor tinker right now.

"command": [
"nc",
"localhost",
"6005"
],
"selector": "source.gd | source.gdscript",
"enabled": true,

@rwols
Copy link
Member

rwols commented Jul 16, 2023

@weckr the place to change this is probably in

def create_transport(config: TransportConfig, cwd: Optional[str],

@weckr
Copy link
Contributor

weckr commented Jul 16, 2023

thanks, the nc way gets buggy and slow for some reason (although at this point it just may be godots lsp), so in the end I managed to hack it in somehow.

@predragnikolic
Copy link
Member

fixed with #2300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants