-
Notifications
You must be signed in to change notification settings - Fork 148
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 server status endpoint #81
Add server status endpoint #81
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
Can we get a list of all auo-detected + manually configured language servers, e.g. under "available_servers"? |
Also, I'm not sure how to identify the sessions on the frontend. Can we intercept the filename and use it as an identifier? |
Yeah, so this is revealing a few things deeper in the model that I haven't really documented (which this will further complicate). I should probably draw a picture of it. Any qualms about going "full lab" and using jupyterlab-drawio?
this is all the detected (potential) servers
there isn't much to identify. Each websocket (
def load_jupyter_server_extension(nbapp):
# obviously we wouldn't do it this way, but what would someone else do?
# another extension developer might need to IOLoop.call_later
mgr = nbapp.language_server_manager
@mgr.on_message(languages=".*", methods=r"textDocument/did(Open|Close)")
def do_thing_with_message(
# would be nice if i could generate this from a JSON schema
message: LSPMessage,
# it would be nice if these had common read/write API
sender: Union[LanguageServerSession, LanguageServerWebSocketHandler]
):
open_file_uris = list(mgr.open_file_uris)
try:
method = message["method"]
uri = message["textDocument"]["uri"]
except:
return
if method == "textDocument/didOpen" and url not in open_file_uris:
open_file_uris.append(uri)
elif method == "textDocument/didClose" and url in open_file_uris:
open_file_uris.remove(uri)
else:
return
mgr.open_file_uris = open_file_uris
# ...and then it would go off an do something on the reporting channel |
Okay, I get it now, I misread the example. I though that sessions correpond to connections, but they reallly correspond to language servers (and those are actually sessions for the backend). Sorry about that! |
I can rename them servers, if that would help!
…On Wed, Oct 30, 2019, 10:18 M. Krassowski ***@***.***> wrote:
Okay, I get it now, I misread the example. I though that sessions
correpond to connections, but they reallly correspond to language servers
(and those are actually sessions for the backend). Sorry about that!
—
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/81?email_source=notifications&email_token=AAALCRAJBBOUT524FLQ4W6DQRGJTFA5CNFSM4JGTMC22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECULHJI#issuecomment-547926949>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALCRCQ7IWBGSVYNZMAIJDQRGJTFANCNFSM4JGTMC2Q>
.
|
Now I see that you got this covered in schema (" However, I think that it would be useful for the users to know the name of the language server (and to have it here so we can expose it in the UI). For example, is the Even better, we could require (or allow) an additional filed in our python-based LSP specification with the URL to the repo or documentation of the server - this way we could hint the users (directly in the UI) where to go to discover server-specific configuration. |
👍
…On Wed, Oct 30, 2019, 10:26 M. Krassowski ***@***.***> wrote:
Now I see that you got this covered in schema ("a list of servers that
are, could be, or were running"), so that is fine no need to rename.
However, I think that it would be useful for the users to know the name of
the language server (and to have it here so we can expose it in the UI).
For example, is the pyls running or Microsoft's python-language-server?
This is of course not so important yet, but once other power-users will
start playing around with settings and swapping the LSP servers to their
liking this could become an annoyance.
Even better, we could require (or allow) an additional filed in the LSP
specification with the URL to the repo or documentation of the server -
this way we could hint the users (directly in the UI) where to go to
discover server-specific configuration.
—
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/81?email_source=notifications&email_token=AAALCRH7SRQL37276FMSVNTQRGKQ3A5CNFSM4JGTMC22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECUMGBI#issuecomment-547930885>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALCREFA63TQCDCZLHNSMLQRGKQ3ANCNFSM4JGTMC2Q>
.
|
And further, this could be the canonical place where we put the mime type
mappings.
display_name: pyls
docs_url: https://...
help_url: https://...
mime_types:
- text/python
- text/x-ipython
…On Wed, Oct 30, 2019, 10:42 Nicholas Bollweg ***@***.***> wrote:
👍
On Wed, Oct 30, 2019, 10:26 M. Krassowski ***@***.***>
wrote:
> Now I see that you got this covered in schema ("a list of servers that
> are, could be, or were running"), so that is fine no need to rename.
>
> However, I think that it would be useful for the users to know the name
> of the language server (and to have it here so we can expose it in the UI).
> For example, is the pyls running or Microsoft's python-language-server?
> This is of course not so important yet, but once other power-users will
> start playing around with settings and swapping the LSP servers to their
> liking this could become an annoyance.
>
> Even better, we could require (or allow) an additional filed in the LSP
> specification with the URL to the repo or documentation of the server -
> this way we could hint the users (directly in the UI) where to go to
> discover server-specific configuration.
>
> —
> 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/81?email_source=notifications&email_token=AAALCRH7SRQL37276FMSVNTQRGKQ3A5CNFSM4JGTMC22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECUMGBI#issuecomment-547930885>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAALCREFA63TQCDCZLHNSMLQRGKQ3ANCNFSM4JGTMC2Q>
> .
>
|
Sounds good. Btw, jupyterlab-drawio requires some attention, I use it daily but there are some annoying bugs I wish I had time to fix. |
Thank you! I will use it for the status bar tonight! |
groovy.
I'll catch up a bit and see where we can go... Please do shout out if there
are things that would be helpful to add aside from what we've already
mulled over...
…On Wed, Oct 30, 2019, 16:37 M. Krassowski ***@***.***> wrote:
Thank you! I will use it for the status bar tonight!
—
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/81?email_source=notifications&email_token=AAALCREUXQJKBZJOPCOXVDTQRHWB7A5CNFSM4JGTMC22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECVV53I#issuecomment-548101869>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALCREEB24IBSWF6ZXWKBTQRHWB7ANCNFSM4JGTMC2Q>
.
|
@@ -0,0 +1,68 @@ | |||
{ |
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 am experimenting with augmenting the statusbar with the server extension status; I was thinking about generating typescript interfaces from this schema e.g. with https://www.npmjs.com/package/json-schema-to-typescript. Any experiences or thoughts on this @bollwyvl?
Yes, absolutely, I put that as a to-do on the wip branch that has all of
the good stuff like display name and mime types. Indeed, there's probably
an opportunity to reduce the amount of special typescript we have to write
for each language if we can capture it in a declarative way where the
server is created... For example, what will the complexity be like to
generate the synthetic Scala files we need from notebooks? If we can get
that part out of typescript AND python and into JSON, then we're that much
closer to being able to scale the contribution process.
For now, I'd favor the back end holding the canonical copy, as it is the
part that is has to actually generate the stuff... Or we raise it to a
top-level "schemas/" and copy it out to both places at build time. This is
another one that should eventually be _done_, and should change more slowly
than either the front end or back end, for everyone's sanity.
I haven't explored the various options in a while for which actual tool to
use, having recently been interested in the opposite direction... I guess
it's a matter of determining which one gives us the features and naming
we'd most like to use.
I think the form it would take would be a new, separate
"packages/language-server-schema/src" that contains a .ts or .d.ts (as well
as a copy of the schema in raw form) and can be imported by whichever
packages need them. In the past, I've often found it useful to have the
main imported index.ts _not_ be generated, and expose a few key types
simply (e.g LanguageServerSpec), with the rest available under an
importable namespace, (e.g Schema.InstallHelp).
If you want to take this on, by all means, I can react to whatever you end
up with... But you may wish to already look at what's over on the pr rather
than what's on master.
…On Mon, Nov 4, 2019, 19:28 M. Krassowski ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In py_src/jupyter_lsp/schema/servers.schema.json
<https://github.com/krassowski/jupyterlab-lsp/pull/81#discussion_r342335504>
:
> @@ -0,0 +1,68 @@
+{
I am experimenting with augmenting the statusbar with the server extension
status; I was thinking about generating typescript interfaces from this
schema e.g. with https://www.npmjs.com/package/json-schema-to-typescript.
Any experiences or thoughts on this @bollwyvl
<https://github.com/bollwyvl>?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/krassowski/jupyterlab-lsp/pull/81?email_source=notifications&email_token=AAALCRENJG3KZT45TZHOXSTQSC423A5CNFSM4JGTMC22YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKID4CI#pullrequestreview-311442953>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALCRDEYE4PTVXXDKJEXOLQSC423ANCNFSM4JGTMC2Q>
.
|
#90 is ready for review: if you like, I can take a crack at generating some types into a new package, or you can go after it closer to the work where you want it... |
For https://github.com/krassowski/jupyterlab-lsp/pull/78#issuecomment-546907659
This adds a REST-ish (whatever) JSON endpoint for getting the current state of the server sessions at
/lsp
(no trailing slash).example response
Not sure what else we're looking for at this point.
There is a JSON schema (for testing, not presently hot validating) which we could generate typescript with, if that helps.
Everything it reports is already evented through
traitlets
, so this could relatively easily be Yet Another WebSocket, but we'll cross that bridge when we have to, I suppose, as it would require a breaking change to the URL schema, probably. Perhapslsp/server/python
andlsp/servers
or something.It also currently doesn't detect error states in a meaningful way, but we could potentially infer them by looking at the queue lengths, perhaps.