-
Notifications
You must be signed in to change notification settings - Fork 149
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
Use language server implementation instead of language for URLs #199
Use language server implementation instead of language for URLs #199
Conversation
starting point for getting the frontend to compile: |
"typescript-jsx", | ||
"typescript", | ||
"yaml", | ||
KNOWN_SERVERS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice thing here is it is now slightly faster...
Turns out I didn't have to do #190, so I didn't. Otherwise seems pretty good! |
atest/01_Editor.robot
Outdated
@@ -19,7 +19,7 @@ CSS | |||
|
|||
Docker | |||
${def} = Set Variable xpath://span[contains(@class, 'cm-string')][contains(text(), 'PLANET')] | |||
Editor Shows Features for Language Docker Dockerfile Diagnostics=Instruction has no arguments Jump to Definition=${def} Rename=${def} | |||
Wait Until Keyword Succeeds 3x 100ms Editor Shows Features for Language Docker Dockerfile Diagnostics=Instruction has no arguments Jump to Definition=${def} Rename=${def} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this "fixes" the problem, but the fact remains that you don't reliably get diagnostics back from a dockerfile on the first file opened until you change the file (then it seems to work every time). I tried sending more change events, but it didn't have an effect. I'm willing to deal with it if it makes the tests pass for now.
@@ -34,6 +40,7 @@ def __repr__(self): # pragma: no cover | |||
def __init__(self, **kwargs): | |||
super().__init__(**kwargs) | |||
self.log.debug("%s initialized", self) | |||
self.executor = ThreadPoolExecutor(max_workers=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought all of the jiggery pokery i did with the streams was sufficient to handle this, but I've still hit some slowdown. This should Make Sure we don't block the main thread on IO below
@@ -87,7 +94,7 @@ def wake(self): | |||
else: | |||
self.wake() | |||
|
|||
await self.queue.put(message) | |||
IOLoop.current().add_callback(self.queue.put_nowait, message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, I don't think this was causing issues, but better be safe...
@@ -98,12 +105,12 @@ def wake(self): | |||
message = "" | |||
headers = HTTPHeaders() | |||
|
|||
line = self._readline() | |||
line = await convert_yielded(self._readline()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are other wrappers that wouldn't require converting, but this works...
|
||
@run_on_executor | ||
def _write_one(self, message) -> None: | ||
self.stream.write(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could have moved more string operations here, but keeps the critical region more clear
I'll have a look at fixing the merge conflicts presently... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I note two debug calls that would be best moved to a console script the future, but they are not a big hurdle right now. Will merge in 2 hours.
Ok, I will wait! |
Ok, provided docker doesn't flake out on us, this is good to go if CI passes. |
@@ -16,11 +23,19 @@ def extract_or_none(obj, path): | |||
|
|||
|
|||
class EditableFile: | |||
executor = ThreadPoolExecutor(max_workers=MAX_WORKERS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
following the same approach as stdio, but in this case we have one executor for all instances of EditableFile
. 4 seems like enough for now.
self.lines = await convert_yielded(self.read_lines()) | ||
|
||
async def write(self): | ||
return await convert_yielded(self.write_lines()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these just wrap the underlying tornado yield-style async stuff.
file = EditableFile(path) | ||
editable_file = EditableFile(path) | ||
|
||
await editable_file.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renaming is cosmetic, just don't need to go re-defining builtins without a good reason.
It's a little ugly to have to do the read: could add an async
class method to EditableFile
to do both in one go...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a small hill, but file is not a builtin in Python3 and it is ok to use it. It was in Python2, and yes some syntax highlighters did not catch up, but we can use it now.
have definitely still been getting the dockerfile issue locally... very challenging to reproduce, apparently... |
ha, fair.
…On Sat, Feb 22, 2020 at 4:25 PM Michał Krassowski ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In py_src/jupyter_lsp/virtual_documents_shadow.py
<https://github.com/krassowski/jupyterlab-lsp/pull/199#discussion_r382942639>
:
> @@ -125,7 +141,9 @@ def setup_shadow_filesystem(virtual_documents_uri):
return
path = file_uri_to_path(uri)
- file = EditableFile(path)
+ editable_file = EditableFile(path)
+
+ await editable_file.read()
It's a small hill, but file is not a builtin in Python3
<https://stackoverflow.com/a/24942363/6646912> and it is ok to use it. It
was in Python2, and yes some syntax highlighters did not catch up, but we
can use it now.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/krassowski/jupyterlab-lsp/pull/199?email_source=notifications&email_token=AAALCRGSJZJPJAAIQXKAOPLREGJ3XA5CNFSM4KV4STL2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCWR3VKY#discussion_r382942639>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALCRGS7KTUEWXL4PBDSXLREGJ3XANCNFSM4KV4STLQ>
.
|
I swear I'm done tinkering now. |
Now let's hope we will have CI pass on master ;) |
Hooray merge! Boo ci fail! We could mark it as non-critical, but those have
a tendency to get ignored. looks like there's a new version we could try. I
guess we need an issue.
Aside from fixing the docker issue, what's the next thing we want to get
to? With this PR in, per-server configuration is unblocked, and would help
a lot, as is the mimetype-based detection stuff.
I'm also interested in the multiple connection providers: being able to
install js-only servers as lazy loading labextensions would help the
install complexity around run-time node without negatively impacting
performance much: and json and markdown would be great initial candidates,
especially if more things like settings manager/cell metadata and markdown
cells could be extended.
… |
References
Code changes
backend
/lsp/ws/pyls
/lsp/status
fix frontend
ILanguageServerManager
ILSM
inConnectionManager
andStatusBarItem
User-facing changes
Backwards-incompatible changes
2
{"session": {"pyls": {}}}
Chores