Add the capability in analysis server protocol for clients to express
interest in receiving not yet imported code completions from specific packages and libraries. The design of this interaction aims to avoid forcing analysis server to send every public symbol from dependent packages at every completion. Instead, clients express interest in certain packages and/or libraries and analysis server will notify with the entire set of symbols for each of them only once. Then it is the client's responsibility to save these pre-computed completions in memory, and analysis server can instruct the client on how to union them with the base set of completion suggestions at code completion time. Bug: https://github.com/dart-lang/sdk/issues/35680 Change-Id: I42c6fddc5d8daa2b546daa81456c0992e3ef547d Reviewed-on: https://dart-review.googlesource.com/c/90125 Commit-Queue: Ari Aye <ariaye@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
7a95930bee
commit
d4b8e0696d
@@ -389,6 +389,22 @@ public interface AnalysisServer {
|
||||
*/
|
||||
public void analytics_sendTiming(String event, int millis);
|
||||
|
||||
/**
|
||||
* {@code completion.getSuggestionDetails}
|
||||
*
|
||||
* Clients must make this request when the user has selected a completion suggestion from an
|
||||
* AvailableSuggestionSet. Analysis server will respond with the text to insert as well as any
|
||||
* SourceChange that needs to be applied in case the completion requires an additional import to be
|
||||
* added. It is an error if the id is no longer valid, for instance if the library has been removed
|
||||
* after the completion suggestion is accepted.
|
||||
*
|
||||
* @param label The label from the AvailableSuggestionSet with the `id` for which insertion
|
||||
* information is requested.
|
||||
* @param file The path of the file into which this completion is being inserted.
|
||||
* @param id The identifier of the AvailableSuggestionSet containing the selected name.
|
||||
*/
|
||||
public void completion_getSuggestionDetails(String label, String file, int id, GetSuggestionDetailsConsumer consumer);
|
||||
|
||||
/**
|
||||
* {@code completion.getSuggestions}
|
||||
*
|
||||
@@ -399,6 +415,35 @@ public interface AnalysisServer {
|
||||
*/
|
||||
public void completion_getSuggestions(String file, int offset, GetSuggestionsConsumer consumer);
|
||||
|
||||
/**
|
||||
* {@code completion.registerLibraryPaths}
|
||||
*
|
||||
* The client can make this request to express interest in certain libraries to receive completion
|
||||
* suggestions from based on the client path. If this request is received before the client has
|
||||
* used 'completion.setSubscriptions' to subscribe to the AVAILABLE_SUGGESTION_SETS service, then
|
||||
* an error of type NOT_SUBSCRIBED_TO_AVAILABLE_SUGGESTION_SETS will be generated. All previous
|
||||
* paths are replaced by the given set of paths.
|
||||
*
|
||||
* @param paths A list of objects each containing a path and the additional libraries from which
|
||||
* the client is interested in receiving completion suggestions. If one configured path is
|
||||
* beneath another, the descendent will override the ancestors' configured libraries of
|
||||
* interest.
|
||||
*/
|
||||
public void completion_registerLibraryPaths(List<LibraryPathSet> paths);
|
||||
|
||||
/**
|
||||
* {@code completion.setSubscriptions}
|
||||
*
|
||||
* Subscribe for completion services. All previous subscriptions are replaced by the given set of
|
||||
* services.
|
||||
*
|
||||
* It is an error if any of the elements in the list are not valid services. If there is an error,
|
||||
* then the current subscriptions will remain unchanged.
|
||||
*
|
||||
* @param subscriptions A list of the services being subscribed to.
|
||||
*/
|
||||
public void completion_setSubscriptions(List<String> subscriptions);
|
||||
|
||||
/**
|
||||
* {@code diagnostic.getDiagnostics}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user