8000 Try running pylsp script, can't output message and quit,what? · Issue #268 · python-lsp/python-lsp-server · GitHub
[go: up one dir, main page]

Skip to content

Try running pylsp script, can't output message and quit,what? #268

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

Closed
Hebe970217 opened this issue Sep 23, 2022 · 6 comments
Closed

Try running pylsp script, can't output message and quit,what? #268

Hebe970217 opened this issue Sep 23, 2022 · 6 comments

Comments

@Hebe970217
Copy link

Screenshot_select-area_20220923183144

install step
pip3 install git+https://github.com/python-lsp/python-lsp-server.git // less root

try running
cd ~/.local/bin && ./pylsp --log-file ./log <init.json

protocol init request text
init.txt
need save file suffix to json

Please help!

@Hebe970217
Copy link
Author
Hebe970217 commented Sep 23, 2022

guess the parent procee id invalid,when I changed init request param processId,but it's not work so.

lanuch this, add args -v,execute result :
Screenshot_select-area_20220923184725

@Hebe970217 Hebe970217 changed the title Try running pylsp script, can't output message and quit Try running pylsp script, can't output message and quit,what? Sep 23, 2022
@ccordoba12
Copy link
Member

Hey @Hebe970217, thanks for reporting. I don't understand where you get the impression that this server can be configured through stdout like you're trying to do.

This is its help:

usage: pylsp [-h] [--tcp] [--ws] [--host HOST] [--port PORT]
             [--check-parent-process]
             [--log-config LOG_CONFIG | --log-file LOG_FILE] [-v] [-V]

Python Language Server

optional arguments:
  -h, --help            show this help message and exit
  --tcp                 Use TCP server instead of stdio
  --ws                  Use Web Sockets server instead of stdio
  --host HOST           Bind to this address
  --port PORT           Bind to this port
  --check-parent-process
                        Check whether parent process is still alive using
                        os.kill(ppid, 0) and auto shut down language server
                        process when parent process is not alive.Note that
                        this may not work on a Windows machine.
  --log-config LOG_CONFIG
                        Path to a JSON file containing Python logging config.
  --log-file LOG_FILE   Redirect logs to the given file instead of writing to
                        stderr.Has no effect if used with --log-config.
  -v, --verbose         Increase verbosity of log output, overrides log config
                        file
  -V, --version         show program's version number and exit
8000

@Hebe970217
Copy link
Author
Hebe970217 commented Sep 26, 2022

@Hebe970217,感谢报道。我不明白您在哪里得到的印象是可以像您尝试做的那样通过标准输出配置此服务器。

这是它的帮助:

usage: pylsp [-h] [--tcp] [--ws] [--host HOST] [--port PORT]
             [--check-parent-process]
             [--log-config LOG_CONFIG | --log-file LOG_FILE] [-v] [-V]

Python Language Server

optional arguments:
  -h, --help            show this help message and exit
  --tcp                 Use TCP server instead of stdio
  --ws                  Use Web Sockets server instead of stdio
  --host HOST           Bind to this address
  --port PORT           Bind to this port
  --check-parent-process
                        Check whether parent process is still alive using
                        os.kill(ppid, 0) and auto shut down language server
                        process when parent process is not alive.Note that
                        this may not work on a Windows machine.
  --log-config LOG_CONFIG
                        Path to a JSON file containing Python logging config.
  --log-file LOG_FILE   Redirect logs to the given file instead of writing to
                        stderr.Has no effect if used with --log-config.
  -v, --verbose         Increase verbosity of log output, overrides log config
                        file
  -V, --version         show program's version number and exit

Sorry,I watch java(jdtls) and c++(clangd) lps can to use, it's working.
I try lanuch pylsp to stdio, this is the problem.
default mode is process stdio, it's can read and write, right?

@ccordoba12
Copy link
Member

Sure, you can launch it in studio mode, but this server needs to be configured from the client.

@Hebe970217
Copy link
Author

Sure, you can launch it in studio mode, but this server needs to be configured from the client.

I tried to input my protocol file into stdin using stdio redirection symbols. It seems that it doesn't respond. Is there a problem with my protocol. Because I tried to pass an empty params, it seemed to exit directly.

I havn't frontend same vscode, cause I development a IDE for now.
I am integrating the language server of python, Maybe the easy to use method is not suitable for me, such as vscode.
I have just started to explore lsp for python. If you have any good suggestions, please let me know. I would be grateful.

@Hebe970217
Copy link
Author
Hebe970217 commented Sep 26, 2022

Sure, you can launch it in studio mode, but this server needs to be configured from the client.

The client starts because it needs to add a monitor for processID. I directly specify the ProcessId of a resident process. According to normal understanding, it can still start. I don't quite understand the difference between starting from client and terminal for u said.

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

No branches or pull requests

2 participants
0