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

Add --version CLI argument and return version in InitializeResult #44

Merged
merged 1 commit into from
Jun 25, 2021

Conversation

nemethf
Copy link
Contributor

@nemethf nemethf commented Jun 23, 2021

The extension of InitializeResult is especially useful in tcp mode when users want to check whether the client communicates with pyls or pylsp (or some other python language servers).

Thanks

@ccordoba12 ccordoba12 added this to the v1.1.0 milestone Jun 23, 2021
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nemethf, thanks for your contribution! Looks good to me, except for the linter issues.

@@ -57,13 +58,22 @@ def add_arguments(parser):
help="Increase verbosity of log output, overrides log config file"
)

parser.add_argument(
'-V', '--version', action='store_true',
Copy link
Contributor

@rchl rchl Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it common to use the -V option for showing the version? I don't think I've ever seen this used before. And -v is usually used for verbose logging so it seems a little too close to that. Is having --version not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied it from python, but I can remove the short option if needed

usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
-v     : verbose (trace import statements); also PYTHONVERBOSE=x
         can be supplied multiple times to increase verbosity
-V     : print the Python version number and exit (also --version)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it looks like argparse have native support for "--version" handling. See:

Screenshot 2021-06-24 at 09 06 19

https://docs.python.org/3/library/argparse.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. That would simplify the patch a bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If python does it then I guess it's fine.

But could use that "native" way to add the argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I've pushed a new version. Thanks

@nemethf
Copy link
Contributor Author

nemethf commented Jun 24, 2021

I force-pushed a fix to the linter issue, but now github requires approval once again to run the tests. What's the right way to correct a mistake like this? (Unfortunately, it's too complicated for me to run the tests locally.)

@ccordoba12
Copy link
Member

What's the right way to correct a mistake like this?

Unfortunately, for first time contributors all projects are required to approve running tests.

@ccordoba12 ccordoba12 self-assigned this Jun 25, 2021
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nemethf!

@ccordoba12 ccordoba12 merged commit bc89ac4 into python-lsp:develop Jun 25, 2021
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

Successfully merging this pull request may close these issues.

3 participants