Skip to content

Deprecate/remove parts of the legacy Analysis Server protocol that are not used by clients #60043

Open

Description

@DanTup

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).

Some possible candidates:

Although, I don't know if there's a simple way to determine what IntelliJ does/doesn't use.

Activity

  1. bwilkerson commented on Feb 4, 2025

    @bwilkerson
    Member

    @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?

  2. added
    type-code-healthInternal changes to our tools and workflows to make them cleaner, simpler, or more maintainable
    P2A bug or feature request we're likely to work on
    on Feb 10, 2025
  3. added
    area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
    and removed on Feb 21, 2025
  4. DanTup commented on Feb 6, 2026

    @DanTup
    CollaboratorAuthor

    @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?).

  5. pq commented on Feb 6, 2026

    @pq
    Member

    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)

  6. helin24 commented on Feb 10, 2026

    @helin24
    Contributor

    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?

  7. bwilkerson commented on Feb 10, 2026

    @bwilkerson
    Member

    Signature Help

    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.

  8. DanTup commented on Feb 10, 2026

    @DanTup
    CollaboratorAuthor

    @helin24

    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.

    @bwilkerson

    Signature Help

    I don't see that in the spec

    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.

  9. DanTup commented on Feb 10, 2026

    @DanTup
    CollaboratorAuthor

    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:

    • analysis.getHover
    • analysis.getImportedElements
    • analysis.getNavigation
    • analysis.reanalyze
    • analysis.setAnalysisRoots
    • analysis.setSubscriptions
    • completion.getSuggestionDetails (and getSuggestionDetails2)
    • completion.getSuggestions (and getSuggestions2)
    • completion.setSubscriptions
    • diagnostic.getServerPort
    • edit.format
    • edit.getAssists
    • edit.getPostfixCompletion
    • edit.getRefactoring
    • edit.getStatementCompletion
    • edit.importElements
    • edit.isPostfixCompletionApplicable
    • edit.listPostfixCompletionTemplates
    • edit.organizeDirectives
    • edit.sortMembers
    • execution.createContext
    • execution.deleteContext
    • execution.mapUri
    • search.findElementReferences
    • search.getTypeHierarchy
    • server.setSubscriptions

    These are the notifications that the plugin registers listeners for:

    • analysis.closingLabels
    • analysis.errors
    • analysis.flushResults
    • analysis.highlights
    • analysis.implemented
    • analysis.navigation
    • analysis.outline
    • analysis.overrides
    • completion.availableSuggestions
    • completion.existingImports
    • completion.results
    • search.results
    • server.connected
    • server.error
    • server.status

    The following (from the original list) appear to be unused in the current plugin implementation:

    • analysis.getErrors (errors are handled via the analysis.errors notification instead)
    • analysis.occurrences (notification)
    • analysis.analyzedFiles (notification)
    • analytics.sendEvent / analytics.enable
    • edit.bulkFixes
  10. bwilkerson commented on Feb 10, 2026

    @bwilkerson
    Member
    • edit.bulkFixes

    That one was added to support dart fix. (Both dart fix and dart analyze use 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.

  11. helin24 commented on Feb 10, 2026

    @helin24
    Contributor

    but failed to find how the request names map to those methods

    I think AnalysisServer.java is the file generated by analysis server code to show the interface of the methods, and RemoteAnalysisServerImpl.java contains the methods that are ultimately called from the plugin to post to stdio to communicate with analysis server. (e.g. for getHover - 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.

    Note that analysis.occurrences is a notification.

    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.

  12. bwilkerson commented on Feb 10, 2026

    @bwilkerson
    Member

    There's a NotificationAnalysisOccurrencesProcessor, but I can't navigate to it so I can't see what it's doing with the data.

  13. helin24 commented on Feb 10, 2026

    @helin24
    Contributor

    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.

  14. FMorschel commented on Feb 10, 2026

    @FMorschel
    Contributor

    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).

  15. bwilkerson commented on Feb 11, 2026

    @bwilkerson
    Member

    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.

  16. FMorschel commented on Feb 11, 2026

    @FMorschel
    Contributor

    I found the reference in question:

    @alexander-doroshko in Dart-Code/Dart-Code/4454's comment (the comment mentioned above):

    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.

  17. alexander-doroshko commented on Feb 11, 2026

    @alexander-doroshko

    Hi,

    Occurrences has 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:

    • 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
  18. alexander-doroshko commented on Feb 11, 2026

    @alexander-doroshko

    Hint: you may remove 'generated' flag from the thirdPartySrc/analysisServer source root

    Image

    and you'll immediately see unused methods of the AnalysisServer class:

    Image

    You can run inspection by name on this class to get the full list:

    Image

    Here it is

    Image
  19. alexander-doroshko commented on Feb 11, 2026

    @alexander-doroshko

    Next hint: to find unused methods of AnalysisServerListener, invoke 'Override Methods' action inside DartAnalysisServerService#myAnalysisServerListener. The list is ready:

    Image
  20. alexander-doroshko commented on Feb 11, 2026

    @alexander-doroshko

    Speaking of DartAnalysisServerImpl, there are only 3 methods that it overrides:

    • server_openUrlRequest
    • server_showMessageRequest
    • lsp_workspaceApplyEdit

    Now you have the full list of the Analysis Server APIs that the Dart plugin doesn't use.

  21. pq commented on Feb 11, 2026

    @pq
    Member

    Super. Thanks, Alex!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-serverIssues related to some aspect of the analysis servertype-code-healthInternal changes to our tools and workflows to make them cleaner, simpler, or more maintainable

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions