-
Notifications
You must be signed in to change notification settings - Fork 208
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
replace internals of symbols machinery with more comprehensive model of spring components #1006
Comments
As a first step, we should collect the basic content for the internal model and what information it should provide. Initial thoughts are:
This list of beans would not contain things like request mappings or other higher level concepts. |
I am working on a spike for this in a branch (https://github.com/spring-projects/sts4/tree/spring-metamodel-spike). The initial steps focus on the internal implementation and source code parsing, which piggybacks on the symbol parsing infrastructure, but creates an independent model representation. I haven't created an extension to the LSP interface to query this model from the outside yet, that is one of the many additional steps that I need to work on. Nevertheless, I wanted to update you on the initial steps here:
Each injection point has information about
The injection points take In addition to that, the external API will get a method to find potential matching beans for an injection point. The client should NOT implement any logic how to match beans against injection points, etc. All that logic will go into the model to have one place where the spring specific knowledge about those things sits. |
Some feedback from use cases in dashboard:
|
I think this point is an interesting question. From the Spring Boot language server perspective, we don't really know exactly when things are done. The language server reacts to receiving information about projects and their corresponding classpath, so whenever we receive such an event, the indexer would update itself for that corresponding project. And whenever a project changes or a file inside of a project changes, the indexer again would update itself. We could keep track (inside of the indexer) which projects are currently covered by the index and which not (yet). And in case a request comes in for a project that the indexer tracks, but has some indexing work in the queue, wait for this indexing work to be done before returning the result. But how do we deal with index updates caused by other activities such as saving a file or updating the classpath? It feels to me like the indexer should have a notification mechanism that tells interested parties when stuff happens, like the index information for a certain file or project has changed, has been created, or has been deleted. In that case, the dashboard could react to those update events and display the corresponding information whenever they arrive. @Eskibear What do you think? |
It would be great that the indexer tracks which projects are covered. And for request related to a project not covered yet, it can immediately return null instead of an empty list. That would remove the ambiguity. The notification mechanism sounds good to me (if it's not too complicated to implement), just like what you did when live processes connect/update/disconnect. |
The first steps towards this new index have arrived in the Here is the extension API: This is backed by the spring boot language server and corresponding LSP extensions: Feel free to take an early look and play around with this. There are only the first steps here, but a good starting point to get feedback here. Important note: The information is recorded by the language server in order to implement further additions to the protocol, so that you can ask the language server for possible beans that match a certain injection point, etc. I know that this is a feature you had in mind, but please do not implement this yet yourself on the client side. We would like to keep the logic for finding beans that match injection points in the language server to have most of the spring specific knowledge there and to keep it as closely aligned as possible with the logic that is used by the Spring framework itself at runtime when matching beans. |
Great to see the progress! Thank you @martinlippert ! Got it. Do not use /cc @testforstephen who will follow up and work on Spring related extensions. |
I am closing this item here as a first step towards providing the new index information. Further changes and improvements to this will be marked with the label |
Instead of building the LSP-specific symbols directly while parsing source code, we should extract symbols from a more comprehensive internal model of Spring components that we build while parsing source code.
The internal model of Spring components can then also be provided via an additional API (LSP extension) to feed more information to the UI, for example to allow more sophisticated gutter icons, navigation, etc.
Related issues:
This could also allow the validation mechanisms to retrieve Spring component information.
The text was updated successfully, but these errors were encountered: