-
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
Merged
krassowski
merged 3 commits into
jupyter-lsp:master
from
bollwyvl:add-server-status-endpoint
Oct 30, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import json | ||
import pathlib | ||
|
||
import jsonschema | ||
|
||
HERE = pathlib.Path(__file__).parent | ||
|
||
|
||
def servers_schema() -> jsonschema.validators.Draft7Validator: | ||
""" return a JSON Schema Draft 7 validator for the server status API | ||
""" | ||
return jsonschema.validators.Draft7Validator( | ||
json.loads((HERE / "servers.schema.json").read_text()) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "#/definitions/servers-response", | ||
"title": "jupyter_lsp server status response", | ||
"description": "describes the current state of (potentially) running language servers", | ||
"definitions": { | ||
"servers-response": { | ||
"type": "object", | ||
"properties": { | ||
"sessions": { | ||
"type": "array", | ||
"description": "a list of servers that are, could be, or were running", | ||
"items": { "$ref": "#/definitions/session" } | ||
}, | ||
"version": { | ||
"type": "integer", | ||
"description": "the version of the schema", | ||
"enum": [0] | ||
} | ||
}, | ||
"required": ["sessions", "version"] | ||
}, | ||
"nullable-date-time": { | ||
"description": "a date/time that might not have been recorded", | ||
"oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }] | ||
}, | ||
"session": { | ||
"title": "Language Server Session", | ||
"description": "a language server session", | ||
"additionalProperties": false, | ||
"required": [ | ||
"languages", | ||
"handler_count", | ||
"status", | ||
"last_server_message_at", | ||
"last_handler_message_at" | ||
], | ||
"properties": { | ||
"languages": { | ||
"description": "languages supported by this Language Server", | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"uniqueItems": true, | ||
"minItems": 1 | ||
}, | ||
"handler_count": { | ||
"title": "handler count", | ||
"description": "the count of currently-connected WebSocket handlers", | ||
"type": "integer", | ||
"minValue": 0 | ||
}, | ||
"status": { | ||
"description": "a string describing the current state of the server", | ||
"type": "string", | ||
"enum": ["not_started", "starting", "started", "stopping", "stopped"] | ||
}, | ||
"last_server_message_at": { | ||
"description": "date-time of last seen message from the language server", | ||
"$ref": "#/definitions/nullable-date-time" | ||
}, | ||
"last_handler_message_at": { | ||
"description": "date-time of last seen message from a WebSocket handler", | ||
"$ref": "#/definitions/nullable-date-time" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?