-
Notifications
You must be signed in to change notification settings - Fork 206
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 extension APIs to get live data #751
Conversation
Signed-off-by: Yan Zhang <[email protected]>
await commands.executeCommand(COMMAND_LIVEDATA_GET, query); | ||
} | ||
|
||
// TODO: STS server should send corresponding notification back. |
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.
Corresponding logic has not been implemented in spring-boot-language-server
yet. As this project is well decoupled, I'm not sure where should be the best place to do that. The remaning work should be:
- define custom notifications in
STS4LanguageClient
- send them at the place whereever live process connection is established/disconnected.
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 think org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessConnectorService
is the place to fire off connect/disconnect events.
(For example line 155 would be the place to send connect notification. Note SimpleLanguageServer
is in the constructor, store server.getClient() in the field to call notifyConnected(...)
. Add notifyConnected
, notifyDisconnected
to the STS4LangugeClient
etc. - let us know if you get lost with this, will be happy to help further)
@kdvolder please let us know if you had something else in mind for these notifications
BTW the wiki page doens't cover how to setup dev environment if I'm focusing on sts-vscode's languge server. What I did was build the exec-jar from |
This is awesome @Eskibear , didn't expect this to include the implementation on the language server side already. :-) @BoykoAlex and @kdvolder will follow with here, provide feedback on the comments, merge the request, etc. |
@@ -192,5 +202,42 @@ else if (arg instanceof JsonObject) { | |||
|
|||
return null; | |||
} | |||
|
|||
private CompletableFuture<Object> get(ExecuteCommandParams params) { | |||
String processKey = getProcessKey(params); |
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.
Shouldn't getProcessKey()
be removed completely in favour of getArgumentByKey(String key)
?
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 think getProcessKey()
is just a convenience method, I don't mind having such a method. But I also don't mind if we removed getProcessKey()
and instead called getArgumentByKey(params, "processKey")
.
A general comment. Do we really want to fine tune the parameters of the new |
I looked at the PR and what I see sort of makes sense. However what I do not see and do not understand is how would another extension/plugin be able to call on this I am asking because up until now we have been using commands as a kind of mechanic to allow one extension to call another (or even call 'functions' contributed by another extensions language server). This always seemed like a clunky way to do things, but we didn't / don't know a better way. This PR seems to suggest there is in fact a better way, but I have to admit, only seeing the implementation side of the extension-api does leave me wondering how caller would use the API. |
I could go either way on this. Internally all these bits of information are requested individually and then stitched together for the 'refresh' call. So it makes sense to allow a client to only retrieve the data it wants and not pay the price for fetching things it doesn't care about. Update: looking at it more closely I think the 'get' function only retrieves current data from the cache. So the argument about 'not fetching data you don't want, isn't quite as strong in that case. I like the api definition on the client side. I.e. the types making it clear what kinds of 'queries' are supported. Whether or not we pull the big json data object apart on the client side or on the server side... it doesn't really matter. Maybe doing it on the server is slightly better because it sends smaller json data between client and server. |
@kdvolder Via |
Let's list the use cases that dashboard extension fetch data from sts-vscode and visualize them. Basic use cases:
Advanced use cases (if valid and feasible to implement):
|
@BoykoAlex Our plan is to ship a new version of dashboard extension with live data visualization in this month, so I'm expecting extension APIs to be availabe as soon as we have thorough discussion on the API design, and agree on the implementation details. 😉 |
Alex and I started experimenting a bit and implementing the missing api pieces(i.e. the I mostly like this proposed API using We could address this problem by adding an additional function to the api to retrieve the 'current' list of connected processes. What do you think @Eskibear ? Shall we add something like a |
I have just merged this into main with some extra tweaks / changes that Alex and I did:
Still todo possibly: adding some api function to retrieve existing processKeys (i.e. so client can discover processes that were connected before it registered its listeners). If we want to do this extra work, let's create a new PR or issue for it. I am closing this PR for now. |
A good catch. Adding an API like this should be fine. |
Currently sts-vscode expose its language client to other extensions. In this PR, besides the language client instance, I also expose some APIs for downstream extension to easily get live process data. (see
api.d.ts
)Downstream extension can now listen to events when live connection is connected/disconnected, and decides to fetch live data using the API.