Skip to content

Support new command-line flag for the analysis server #9195

Open

Description

@bwilkerson

A new command-line flag is being added to the analysis server and the IntelliJ plugin should include this flag when the analysis server is started.

The flag is named start-reason and is intended to indicate why the analysis server is being started. For example, there is one value for cases where the plugin is starting the server for the first time, another for when the user requests that the server be restarted, and a couple of values for when the server is being restarted after a crash (depending on what crashed and why it was restarted).

There is a list of reasons that we will be sending from the VS Code plugin and we'd like the list to be consistent between the two plugins. If the list isn't compete or doesn't match the way the VS Code plugin works we're happy to update the list to support your needs. The list can be found here: https://dart-review.googlesource.com/c/sdk/+/570580/2/pkg/analysis_server/lib/src/context_manager.dart (it hasn't landed yet).

We'll need to figure out a way for the plugin to know that the flag is supported. Suggestions welcome.

Activity

  1. DanTup commented on Nov 2, 2026

    @DanTup
    Contributor

    We'll need to figure out a way for the plugin to know that the flag is supported. Suggestions welcome.

    In Dart-Code, we have a dartCapabilities class where we have flags for things like this against the version number:

    get supportsServerStartReason() { return versionIsAtLeast(this.version, "3.15.0-99.0.dev"); }

    While it'd be nice to ask the SDK, these versions are unlikely to change and the check is very fast (compared to reading a file or running a process).

    (My guess is that IntelliJ has something similar since we often add new flags/features that aren't worth adding a way to interrogate)

    Edit: One additional note, is that if the server fails to start, we do look at the stderr output to show a message, because if you often run the server from source, it's easy to have a slight mismatch in these versions - for ex. you updated your bleeding-edge SDK, but switched to an SDK branch without it... It's a very fringe case only likely to be hit by the handful of people that run the server from source though (which might not be many more than just me😄)

  2. bwilkerson commented on Nov 2, 2026

    @bwilkerson
    Author

    Being consistent across the two plugins would be ideal (and I should have thought about that possibility).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions