You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Deprecate/remove parts of the legacy Analysis Server protocol that are not used by clients #60043
There are parts of the legacy server protocol that are only used by VS Code. VS Code has been using LSP for all recent versions of the SDK and all code related to the legacy protocol is being removed for the next version of the extension. We should deprecate and/or remove parts of the legacy protocol that are not used by IntelliJ (or any other clients we know of).
@jwren What's the easiest way for someone (not necessarily you) to find out which protocols are being used in the versions of IntelliJ and Android Studio that we currently support?
@jwren@pq is there an easy way to determine the full set of legacy request methods that IntelliJ uses? (or perhaps there's enough analytics to start from the full list and remove anything that has non-zero stats?).
I believe all of the analysis server APIs used are from DartAnalysisServerService in the Dart plugin code. Given a certain request name, we should be able to find that in the file and check on usages in the Dart plugin, then also do a search in the Flutter plugin. If the request isn't there or leads to dead code in both plugins, then it should be safe to remove. That seems like a rather naive process though; am I missing a concern here?
I don't see that in the spec (although there are three error codes listed there that appear to be dead). Perhaps we already removed it?
Given a certain request name ...
Note that analysis.occurrences is a notification. The question for notifications is whether IntelliJ registers an interest in the information and if so whether it does anything with the information it was given.
I believe all of the analysis server APIs used are from DartAnalysisServerService in the Dart plugin code.
Do you know where the server request names (like analysis.getHover) are? I found some methods for getSingleHover and analysis_gethover but failed to find how the request names map to those methods (my Java is weak and I don't have a language server set up for it so I was doing find-in-files 😄)
I was wondering if it would be easy to extract all of the request + notification names so I can compare to the server.
It's still marked as experimental (<request method="getSignature" experimental="true">). Note: We do use the implementation (DartUnitSignatureComputer) in the LSP handler (SignatureHelpHandler), it's just unlikely anyone is calling the legacy request for it.
I haven't verified this, but I asked Gemini to find this for me, and it told me the below. If it's accurate then maybe there isn't a lot unused. Although, that also means it's a small list to verify via code and/or stats.
Although I'll also note the "full list" it had is from the generated code, and I don't know how complete or up-to-date that is... for example there's no mention of signature help.
These are the methods explicitly called by the plugin:
Okay, this is pretty confusing. So NotificationAnalysisOccurrencesProcessor routes the notification, but to check on usages of computedOccurrences, you have to check the listeners that get registered for analysis server notifications:
Therefore occurrences isn't used. However, if we remove it from the analysis server, we would want to regenerate the java code and then remove references to the notification.
IIRC, occurrences is done today by looking at the positions of the rename (somehow). I remember fixing an occurrence issue on the IJ Plugin by fixing the rename on the server (maybe or pattern variables or something like that).
However, if we remove it from the analysis server, we would want to regenerate the java code and then remove references to the notification.
We'd need to check to see whether the notification was being used by any version of the Dart or Flutter plugins that is still being used by a significant number of users, and only remove support from the server when there are few enough users (hopefully zero) to justify breaking them.
We can remove support from the plugin any time we want.
I remember fixing an occurrence issue on the IJ Plugin by fixing the rename on the server ...
That is incredibly expensive (not what you did, what you found). We should fix that by converting the plugin to use the LSP request.
IntelliJ's Dart plugin doesn't use Occurrences from the server. Occurrences highlighting works using IntelliJ's internal (language-agnostic) mechanism, but based on the references (aka navigation) info from the server. So it works only when the reference and the target have the same text.
I think we want to switch to the Occurrences from the server eventually.
I don't suppose this change has happened yet. This was written on Apr 3, 2023.
There are no Analysis Server APIs that are used by older versions of the Dart plugin but not used in the source code. So if you see no usages in the code, it's safe to remove.
The easiest way to check usages (besides asking AI, which is also good at it) is to open the Dart plugin project in IntelliJ IDEA and search for:
usages of public methods of com.google.dart.server.generated.AnalysisServer (or RemoteAnalysisServerImpl - the list is the same). Effectively, this is the same as looking for usages of the myServer field in com.jetbrains.lang.dart.analyzer.DartAnalysisServerService
methods that com.jetbrains.lang.dart.analyzer.DartAnalysisServerImpl overrides
methods that myAnalysisServerListener in DartAnalysisServerService implements
Next hint: to find unused methods of AnalysisServerListener, invoke 'Override Methods' action inside DartAnalysisServerService#myAnalysisServerListener. The list is ready:
Activity
bwilkerson commentedon Feb 4, 2025
@jwren What's the easiest way for someone (not necessarily you) to find out which protocols are being used in the versions of IntelliJ and Android Studio that we currently support?
DanTup commentedon Feb 6, 2026
@jwren @pq is there an easy way to determine the full set of legacy request methods that IntelliJ uses? (or perhaps there's enough analytics to start from the full list and remove anything that has non-zero stats?).
pq commentedon Feb 6, 2026
Analytics would be a good place to start. If we identify services that seem unused we can double-check.
More proactively, we could also do an audit of the plugin implementation. I'd love to do that but it keeps slipping in priority.
(@helin24 may have some insight too from her LSP explorations)
helin24 commentedon Feb 10, 2026
I believe all of the analysis server APIs used are from
DartAnalysisServerServicein the Dart plugin code. Given a certain request name, we should be able to find that in the file and check on usages in the Dart plugin, then also do a search in the Flutter plugin. If the request isn't there or leads to dead code in both plugins, then it should be safe to remove. That seems like a rather naive process though; am I missing a concern here?bwilkerson commentedon Feb 10, 2026
I don't see that in the spec (although there are three error codes listed there that appear to be dead). Perhaps we already removed it?
Note that
analysis.occurrencesis a notification. The question for notifications is whether IntelliJ registers an interest in the information and if so whether it does anything with the information it was given.DanTup commentedon Feb 10, 2026
@helin24
Do you know where the server request names (like
analysis.getHover) are? I found some methods forgetSingleHoverandanalysis_gethoverbut failed to find how the request names map to those methods (my Java is weak and I don't have a language server set up for it so I was doing find-in-files 😄)I was wondering if it would be easy to extract all of the request + notification names so I can compare to the server.
@bwilkerson
It's still marked as experimental (
<request method="getSignature" experimental="true">). Note: We do use the implementation (DartUnitSignatureComputer) in the LSP handler (SignatureHelpHandler), it's just unlikely anyone is calling the legacy request for it.DanTup commentedon Feb 10, 2026
I haven't verified this, but I asked Gemini to find this for me, and it told me the below. If it's accurate then maybe there isn't a lot unused. Although, that also means it's a small list to verify via code and/or stats.
Although I'll also note the "full list" it had is from the generated code, and I don't know how complete or up-to-date that is... for example there's no mention of signature help.
These are the methods explicitly called by the plugin:
These are the notifications that the plugin registers listeners for:
The following (from the original list) appear to be unused in the current plugin implementation:
bwilkerson commentedon Feb 10, 2026
That one was added to support
dart fix. (Bothdart fixanddart analyzeuse the analysis server via the legacy protocol.)As far as I know the rest are not being used by anything we ship if they aren't used by the IntelliJ plugins.
helin24 commentedon Feb 10, 2026
I think
AnalysisServer.javais the file generated by analysis server code to show the interface of the methods, andRemoteAnalysisServerImpl.javacontains the methods that are ultimately called from the plugin to post to stdio to communicate with analysis server. (e.g. forgetHover- https://github.com/flutter/dart-intellij-third-party/blob/114bef03120f387aade2cbc898748726e2c44d8a/third_party/thirdPartySrc/analysisServer/com/google/dart/server/internal/remote/RemoteAnalysisServerImpl.java#L311). I'm not sure if that answers your question.Good point about notifications being separate from the requests - it seems like this is where all the notifications are handled: https://github.com/flutter/dart-intellij-third-party/blob/114bef03120f387aade2cbc898748726e2c44d8a/third_party/thirdPartySrc/analysisServer/com/google/dart/server/internal/remote/RemoteAnalysisServerImpl.java#L772.
Hopefully those code pointers help us gain confidence about which notifications/requests are unused.
bwilkerson commentedon Feb 10, 2026
There's a
NotificationAnalysisOccurrencesProcessor, but I can't navigate to it so I can't see what it's doing with the data.helin24 commentedon Feb 10, 2026
Okay, this is pretty confusing. So
NotificationAnalysisOccurrencesProcessorroutes the notification, but to check on usages ofcomputedOccurrences, you have to check the listeners that get registered for analysis server notifications:computedOccurrencescomputedOccurrencesTherefore occurrences isn't used. However, if we remove it from the analysis server, we would want to regenerate the java code and then remove references to the notification.
FMorschel commentedon Feb 10, 2026
IIRC, occurrences is done today by looking at the positions of the rename (somehow). I remember fixing an occurrence issue on the IJ Plugin by fixing the rename on the server (maybe or pattern variables or something like that).
bwilkerson commentedon Feb 11, 2026
We'd need to check to see whether the notification was being used by any version of the Dart or Flutter plugins that is still being used by a significant number of users, and only remove support from the server when there are few enough users (hopefully zero) to justify breaking them.
We can remove support from the plugin any time we want.
That is incredibly expensive (not what you did, what you found). We should fix that by converting the plugin to use the LSP request.
FMorschel commentedon Feb 11, 2026
I found the reference in question:
alexander-doroshko commentedon Feb 11, 2026
Hi,
Occurrenceshas never been used.There are no Analysis Server APIs that are used by older versions of the Dart plugin but not used in the source code. So if you see no usages in the code, it's safe to remove.
The easiest way to check usages (besides asking AI, which is also good at it) is to open the Dart plugin project in IntelliJ IDEA and search for:
com.google.dart.server.generated.AnalysisServer(orRemoteAnalysisServerImpl- the list is the same). Effectively, this is the same as looking for usages of themyServerfield incom.jetbrains.lang.dart.analyzer.DartAnalysisServerServicecom.jetbrains.lang.dart.analyzer.DartAnalysisServerImploverridesmyAnalysisServerListenerinDartAnalysisServerServiceimplementsalexander-doroshko commentedon Feb 11, 2026
Hint: you may remove 'generated' flag from the
thirdPartySrc/analysisServersource rootand you'll immediately see unused methods of the
AnalysisServerclass:You can run inspection by name on this class to get the full list:
Here it is
alexander-doroshko commentedon Feb 11, 2026
Next hint: to find unused methods of
AnalysisServerListener, invoke 'Override Methods' action insideDartAnalysisServerService#myAnalysisServerListener. The list is ready:alexander-doroshko commentedon Feb 11, 2026
Speaking of
DartAnalysisServerImpl, there are only 3 methods that it overrides:server_openUrlRequestserver_showMessageRequestlsp_workspaceApplyEditNow you have the full list of the Analysis Server APIs that the Dart plugin doesn't use.
pq commentedon Feb 11, 2026
Super. Thanks, Alex!