| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Thanks for your contribution! Could you please fix the test failures? |
Sorry, something went wrong.
|
I am already working on it. |
Sorry, something went wrong.
|
Please follow the contribution guide here #31 (comment) |
Sorry, something went wrong.
|
I have only updated the tests as of now, I am working on improving the coverage and fix a minor logging issue during running testing. |
Sorry, something went wrong.
| You'll need python version 3.5 or greater, run `pip3 install -r requirements.txt` to install the requirements, and run `python3 langserver-python.py --mode=tcp --addr=2087` to start a local languager server listening at port 2087. | ||
|
|
||
| Then you should update the `./vscode-client/src/extension.ts` to make client in TCP mode. | ||
| Then you should update the `./vscode-client/src/extension.ts` to make client in TCP mode. |
There was a problem hiding this comment.
discard this change. create a newcomer bug about adding style linting rules for this file.
Sorry, something went wrong.
There was a problem hiding this comment.
Noted.
Sorry, something went wrong.
| ``` | ||
|
|
||
| To try it in [Visual Studio Code](https://code.visualstudio.com), open ./vscode-client in VS Code and turn to debug view, launch the extension. | ||
| To try it in [Visual Studio Code](https://code.visualstudio.com), open ./vscode-client in VS Code and turn to debug view, launch the extension. If the langserver fails try disabling the GitCommitBear. |
There was a problem hiding this comment.
Create a newcomer issue about this, and remove it from your PR. it has nothing to do with jsonrpc.
Also a change like this should be done by adding a new line, so the origin of existing line doesnt change unnecessarily.
Sorry, something went wrong.
There was a problem hiding this comment.
Noted.
Sorry, something went wrong.
| import json | ||
| import logging | ||
|
|
||
| log = logging.getLogger(__name__) |
There was a problem hiding this comment.
call this logger
Sorry, something went wrong.
| def start(self): | ||
| self._jsonrpc_stream_reader.listen(self._endpoint.consume) | ||
|
|
||
| # def handle(self, _id, request): |
There was a problem hiding this comment.
we dont want commented out code.
If there is extra stuff to be done, create an issue after this is merged
Sorry, something went wrong.
There was a problem hiding this comment.
A clean up issue, I just wanted to have a reference to the previous code to cross verify.
Sorry, something went wrong.
| params = { | ||
| 'uri': 'file://{0}'.format(path), | ||
| 'diagnostics': _diagnostics, | ||
| 'diagnostics': [] if diagnostics is None else diagnostics, |
There was a problem hiding this comment.
this seems to be a pointless change
Sorry, something went wrong.
| @@ -0,0 +1,35 @@ | |||
| # Copyright 2018 Palantir Technologies, Inc. | |||
There was a problem hiding this comment.
I would prefer that we did not copy other code into the repository. For example, I can not easily check to see if you modified a line from the origin.
While there are some additional dependencies at https://github.com/palantir/python-language-server/blob/develop/setup.py#L34 , could we not require that it is installed, and then use the jsonrpc they provide? If that is not possible, maybe we can coordinate with @palantir to split that out into a sharable library.
This tool is still a prototype, so it can have additional install steps , and keeping the origin of source code clear.
It also means that additional tests for the jsonrpc would be contributed to https://github.com/palantir/python-language-server , so everyone benefits.
Sorry, something went wrong.
There was a problem hiding this comment.
I will follow your recommendations, python-lang-server will be added as a dependency.
Sorry, something went wrong.
| def step_impl(context): | ||
| context.f = tempfile.TemporaryFile() | ||
| context.langServer = LangServer(conn=TCPReadWriter(context.f, context.f)) | ||
| context.file = tempfile.TemporaryFile() |
There was a problem hiding this comment.
why does it need renaming from f to file? It causes all sorts of other unnecessary changes to appear in this PR, slowing down the review.
is that related to the issue that this PR is intending to solve.
Sorry, something went wrong.
There was a problem hiding this comment.
'f' didn't seem to be a semantic name. My intention was to improve readability, retaining such occurrences could indicate tolerance for those practices and could even mean encouragement.
Sorry, something went wrong.
There was a problem hiding this comment.
I think the re-naming is justified, do you still recommend this particular change?
Sorry, something went wrong.
There was a problem hiding this comment.
Of course I do. it is not related to using jsonrpc. Create a new PR for other changes you wish to make.
Sorry, something went wrong.
| """ | ||
| PY3K = sys.version_info >= (3, 0) | ||
|
|
||
| if PY3K: |
There was a problem hiding this comment.
See #35
Sorry, something went wrong.
| server = socketserver.TCPServer((bind_addr, port), wrapper_class) | ||
| except Exception as e: | ||
| log.fatal("Exception: %s", str(e)) | ||
| exit(1) |
There was a problem hiding this comment.
sys.exit?
Sorry, something went wrong.
There was a problem hiding this comment.
Noted.
Sorry, something went wrong.
| import logging | ||
|
|
||
| from .jsonrpc import JSONRPC2Connection, ReadWriter, TCPReadWriter | ||
| from .log import log |
There was a problem hiding this comment.
removing this (and other logging enhancements) should be done as a separate PR. I've assigned #36 to you, as you've already done a lot of this.
Sorry, something went wrong.
There was a problem hiding this comment.
Noted.
Sorry, something went wrong.
| ) | ||
|
|
||
| server = socketserver.TCPServer((bind_addr, port), wrapper_class) | ||
| try: |
There was a problem hiding this comment.
This change should be a new PR.
Ideally create a new issue showing why this change is needed.
Sorry, something went wrong.
| # s = LangServer(conn=ReadWriter(sys.stdin, sys.stdout)) | ||
| # s.listen() | ||
| pass | ||
| stdin, stdout = _binary_stdio() |
There was a problem hiding this comment.
move this code out to a PR for #48
Sorry, something went wrong.
|
As far as I can see, after removing all the unrelated features, there should only be one commit in this PR. fwiw, updating tests should be part of the atomic change of modifying the code. |
Sorry, something went wrong.
|
@ksdme Thanks for your contribution! I think we could try to add some tests. |
Sorry, something went wrong.
| class ThreadingTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): | ||
| pass | ||
| class _StreamHandlerWrapper(socketserver.StreamRequestHandler, object): | ||
| """A wrapper class that is used to construct a custom handler class.""" |
There was a problem hiding this comment.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmp_evza00r/coala_langserver/langserver.py
+++ b/tmp/tmp_evza00r/coala_langserver/langserver.py
@@ -14,7 +14,7 @@
class _StreamHandlerWrapper(socketserver.StreamRequestHandler, object):
- """A wrapper class that is used to construct a custom handler class."""
+ '""A wrapper class that is used to construct a custom handler class.""'
delegate = None
Sorry, something went wrong.
| self.write_response(request['id'], resp) | ||
|
|
||
| def serve_initialize(self, request): | ||
| #TODO: didChange |
There was a problem hiding this comment.
E265 block comment should start with '# '
Origin: PycodestyleBear (E265), Section: autopep8.
Sorry, something went wrong.
| from pyls.jsonrpc.endpoint import Endpoint | ||
| from pyls.jsonrpc.dispatchers import MethodDispatcher | ||
| from pyls.jsonrpc.streams import JsonRpcStreamReader | ||
| from pyls.jsonrpc.streams import JsonRpcStreamWriter |
There was a problem hiding this comment.
You do not use the preferred quotation marks.
Origin: QuotesBear, Section: python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmp7wx9j6yx/coala_langserver/langserver.py
+++ b/tmp/tmp7wx9j6yx/coala_langserver/langserver.py
@@ -111,7 +111,7 @@
try:
server = socketserver.TCPServer((bind_addr, port), wrapper_class)
except Exception as e:
- log("Fatal Exception: {}".format(e))
+ log('Fatal Exception: {}'.format(e))
sys.exit(1)
try:
log('Serving %s on (%s, %s)', handler_class.__name__, bind_addr, port)
Sorry, something went wrong.
|
Comment on f253090. Shortlog of the HEAD commit contains 60 character(s). This is 10 character(s) longer than the limit (60 > 50). Origin: GitCommitBear, Section: commit. |
Sorry, something went wrong.
|
Comment on 45df0f8, file coala_langserver/langserver.py, line 126. Line is longer than allowed. (85 > 79) Origin: LineLengthBear, Section: linelength. |
Sorry, something went wrong.
Increases the codecov target to 95%. Related to coala#27
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 63. The code does not comply to PEP8. Origin: PEP8Bear, Section: autopep8. The issue can be fixed by applying the following patch: --- a/tmp/tmpc942a8vq/tests/server.features/steps/jsonrpc_steps.py
+++ b/tmp/tmpc942a8vq/tests/server.features/steps/jsonrpc_steps.py
@@ -60,7 +60,8 @@
@given('the JSONRPC2Connection instance')
def step_impl(context):
context.f = tempfile.TemporaryFile()
- context.jsonConn = JSONRPC2Connection(conn=TCPReadWriter(context.f, context.f))
+ context.jsonConn = JSONRPC2Connection(
+ conn=TCPReadWriter(context.f, context.f))
@when('I write a request to the JSONRPC2Connection with id') |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 10. E501 line too long (82 > 79 characters) Origin: PycodestyleBear (E501), Section: autopep8. |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 63. E501 line too long (83 > 79 characters) Origin: PycodestyleBear (E501), Section: autopep8. |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 10. Line is longer than allowed. (82 > 79) Origin: LineLengthBear, Section: linelength. |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 63. Line is longer than allowed. (83 > 79) Origin: LineLengthBear, Section: linelength. |
Sorry, something went wrong.
| 'capabilities': {}, | ||
| }, | ||
| 'id': 1, | ||
| 'jsonrpc': '2.0' |
There was a problem hiding this comment.
trailing comma
Sorry, something went wrong.
| 'capabilities': {}, | ||
| }, | ||
| 'id': 1, | ||
| 'jsonrpc': '2.0' |
There was a problem hiding this comment.
trailing comma
Sorry, something went wrong.
There was a problem hiding this comment.
still not done?
Sorry, something went wrong.
| wrapper_class = type( | ||
| handler_class.__name__ + 'Handler', | ||
| (_StreamHandlerWrapper,), | ||
| {'DELEGATE_CLASS': handler_class} |
There was a problem hiding this comment.
trailing comma ; not likely to be needed any time soon, but likely doesnt hurt
Sorry, something went wrong.
| log('Fatal Exception: {}'.format(e)) | ||
| sys.exit(1) | ||
| try: | ||
| log('Serving {} on ({}, {})'.format( |
There was a problem hiding this comment.
log isnt useful inside the try.
but, it is a new log call, and redundant due to existing Accepting TCP connections .. log
Sorry, something went wrong.
There was a problem hiding this comment.
I have to retain this log compared to the other one because the tests watch this log call to trigger sending requests.
Sorry, something went wrong.
|
|
||
| @enforce_signature | ||
| def start_io_lang_server(handler_class: LangServer, rstream, wstream): | ||
| log('Starting {} IO language server'.format(handler_class.__name__)) |
There was a problem hiding this comment.
new log call, also redundant.
Sorry, something went wrong.
There was a problem hiding this comment.
For the reasons mentioned in the previous change request and maintaining uniformity I think I'll have to retain this log and remove the other redundant log call.
Sorry, something went wrong.
There was a problem hiding this comment.
ok.
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 63. The code does not comply to PEP8. Origin: PEP8Bear, Section: autopep8. The issue can be fixed by applying the following patch: --- a/tmp/tmpc942a8vq/tests/server.features/steps/jsonrpc_steps.py
+++ b/tmp/tmpc942a8vq/tests/server.features/steps/jsonrpc_steps.py
@@ -60,7 +60,8 @@
@given('the JSONRPC2Connection instance')
def step_impl(context):
context.f = tempfile.TemporaryFile()
- context.jsonConn = JSONRPC2Connection(conn=TCPReadWriter(context.f, context.f))
+ context.jsonConn = JSONRPC2Connection(
+ conn=TCPReadWriter(context.f, context.f))
@when('I write a request to the JSONRPC2Connection with id') |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 10. E501 line too long (82 > 79 characters) Origin: PycodestyleBear (E501), Section: autopep8. |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 63. E501 line too long (83 > 79 characters) Origin: PycodestyleBear (E501), Section: autopep8. |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 10. Line is longer than allowed. (82 > 79) Origin: LineLengthBear, Section: linelength. |
Sorry, something went wrong.
|
Comment on de0098b, file tests/server.features/steps/jsonrpc_steps.py, line 63. Line is longer than allowed. (83 > 79) Origin: LineLengthBear, Section: linelength. |
Sorry, something went wrong.
| wrapper_class = type( | ||
| handler_class.__name__ + 'Handler', | ||
| (_StreamHandlerWrapper,), | ||
| {'DELEGATE_CLASS': handler_class, } |
There was a problem hiding this comment.
no, a trailing comma is for allowing new additions without modifications to exiting lines. hence this , is not a trailing comma.
{'DELEGATE_CLASS': handler_class},
Sorry, something went wrong.
|
|
||
| @enforce_signature | ||
| def start_io_lang_server(handler_class: LangServer, rstream, wstream): | ||
| log('Starting {} IO language server'.format(handler_class.__name__)) |
There was a problem hiding this comment.
ok.
Sorry, something went wrong.
| 'capabilities': {}, | ||
| }, | ||
| 'id': 1, | ||
| 'jsonrpc': '2.0' |
There was a problem hiding this comment.
still not done?
Sorry, something went wrong.
| def start(self): | ||
| self._jsonrpc_stream_reader.listen(self._endpoint.consume) | ||
|
|
||
| def m_initialize(self, rootUri=None, rootPath=None, **kargs): |
There was a problem hiding this comment.
def m_initialize(self, **params)
then nothing below needs to be modified, except removal of params = request['params']
sorry I didnt notice this earlier.
this helps show the similarities of the two jsonrpc's , making differences more clear
Sorry, something went wrong.
| } | ||
|
|
||
| def serve_did_save(self, request): | ||
| def m_text_document__did_save(self, textDocument=None, **kargs): |
There was a problem hiding this comment.
likewise use **params to avoid changes below
Sorry, something went wrong.
This updates the project to use jsonrpc module from python-language-server. Closes coala#27
|
Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently ⚠️ |
Sorry, something went wrong.
|
Automated fastforward with GitMate.io was successful! 🎉 |
Sorry, something went wrong.
|
🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Updates coala-vs-code to use jsonrpc module from python-language-server (palantir/python-language-server#32).
Closes #27