Skip to content

Don't rely on IDE=VSCode in querystring for behaviour #9811

Open

Description

@DanTup

Dart-Code/Dart-Code#5970 is a request to change the values pass in the querystring passed to DevTools to include the proper IDE name and not hard-coded values like "VSCode" (which prevents distinguishing VS Code forks using the same extension, like Antigravity or Cursor).

However, there are some places that currently assume "VSCode" here in DevTools that I think require reviewing first (or, we need to pass two values).

  1. Survey IDE filters
  2. WASM/JS fallback message
  3. Property editor documentation link

1. Survey IDE Filters

// This list is optional and can be used to limit the survey to a specific
// set of users based on their development environment.
'devEnvironments': ['Android-Studio', 'IntelliJ-IDEA', 'VSCode', 'CLI'],

I don't know if this is used, but if it is, it would need to cover each of the variations of editors now. I think we could either:

  1. Update this comment to mention this is based on DASH__IDE_NAME and include updated examples ("Visual Studio Code", "Antigravity", "Cursor")
  2. Pass two values in querystring, DASH__IDE_NAME and also DASH__TOOL (or DASH__PLUGIN_NAME) which are constant across different IDE flavours using the same plugin/extension

2. WASM/JS fallback message

// Do not show the JS fallback notification when embedded in VS Code
// because we do not expect the WASM build to load successfully by
// default. This is because cross-origin-isolation is disabled by VS
// Code. See https://github.com/microsoft/vscode/issues/186614.
final embeddedInVsCode =
queryParams.embedMode.embedded && queryParams.ide == 'VSCode';
if (!embeddedInVsCode) {
notificationService.push(
'Something went wrong when trying to load DevTools with WebAssembly. '
'Falling back to Javascript.',
);
}

It controls whether to show a message if the wasm version fails. I'm not sure if this is necessary anymore, as I think there were WASM changes to not require COI? If so, this code could probably just be deleted (and if not, I think won't cause any problems). Needs testing though.

3. Property editor documentation link

String? _documentationLink() {
final queryParams = DevToolsQueryParams.load();
final isEmbedded = queryParams.embedMode.embedded;
if (!isEmbedded) return null;
const uriPrefix = 'https://docs.flutter.dev/tools/';
const uriHash = '#property-editor';
return '$uriPrefix${queryParams.ide == 'VSCode' ? 'vs-code' : 'android-studio'}$uriHash';
}

If IDE is not exactly "VSCode" this will link to the Android Studio docs.

Activity

  1. kenzieschmoll commented on Apr 29, 2026

    @kenzieschmoll
    Member

    I propose we add a helper method isVSCodeVariant or similar that contains the set of possible DASH__IDE_NAME values set by Dart Code.

  2. DanTup commented on Apr 29, 2026

    @DanTup
    ContributorAuthor

    I propose we add a helper method isVSCodeVariant or similar that contains the set of possible DASH__IDE_NAME values set by Dart Code.

    This set is not known to us. We know of some (VS Code, Cursor, Antigravity, etc.), but new VS Code forks pop up every day and they can provide their own arbitrary strings (there are also various flavours of VS Code, like Insiders, Dev, OSS).

    I think if we need these checks, we should pass some additional flag/identifier that is static?

  3. kenzieschmoll commented on Apr 29, 2026

    @kenzieschmoll
    Member

    I see. Then it sounds like we will need two values. Perhaps we should leave the ide= query param as is then and pass a new key (ideVariant?)

    In our analytics, we can either:

    1. add another dimension for ideVariant and pass that along with analytics events (no dashboard updates required unless we want to slice by this value)
    2. set the ideLaunched value to ideVariant if is is non-null and fallback to the value of the ide query param otherwise (will require updating DevTools dashboards that check for "VSCode")
    3. since GA only allows 25 event parameters, we can combine the IDE data into a single value we can parse in our dashboard scripts. Something like ide | ideVariant | ideFeature, as long as this must is less than 100 characters. We'd have to make sure this makes sense for IntelliJ too (will require updating DevTools dashboards to parse this value when the DevTools version is > some version)

    Option 3 since it seems like the better long term solution so that we don't bloat our event parameters, but option 1 is the easiest solution today and we could always move to option 3 later if we need to due to event parameter limits.

  4. DanTup commented on Apr 29, 2026

    @DanTup
    ContributorAuthor

    I don't know enough about the analytics to have an opinion on how they're recorded/combined, though for consistency to make it clearer what values to expect, what about adding two new QS params to match the new env vars?

    • dashTool (which gets the value we put into DASH__TOOL)
    • dashIdeName (which gets the value we put into DASH__IDE_NAME)

    This would give the front-end the same values that the DevTools server is getting (same-ish names, and same values).

    Then treat the existing IDE param as a fallback. Checking that needs to know specifically if it's VS Code would be something like:

    var isVsCode = parameters['dashTool'] == 'vscode-plugins' || parameters['ide'] == "VSCode";

    Then in some future when all IDEs/plugins we care about are passing the new values, both the IDE plugins and DevTools could drop IDE?

  5. kenzieschmoll commented on Apr 29, 2026

    @kenzieschmoll
    Member

    This would give the front-end the same values that the DevTools server is getting (same-ish names, and same values).

    Where are these getting sent to the DevTools server and what are the values used for in the server?

    The plan to use dashTool and dashIdeName SGTM as long as we also update the IntelliJ plugin to pass these query parameters, and as long as we have a plan to clean up the tech debt and remove the ide query parameter at some point.

    To summarize, the DevTools query parameters set by the IDE would look like this:

    • ide: [DEPRECATE] No changes, continue to include. Remove after some time period (maybe 2 years to follow existing IDE deprecation policy?)
    • ideFeature: No changes, continue to include
    • dashTool: [NEW] 'vscode-plugins' or 'intellij-plugins'
    • dashIdeName: [NEW] 'Visual Studio Code', 'Cursor', 'Antigravity', 'IntelliJ Community', 'Android Studio', etc.

    Summary of the required changes as I understand them.

    Required changes for Dart-Code extension and IntelliJ plugin:

    • Add the dashTool and dashIdeName query parameters to the DevTools URL
    • File an issue to remove the ide query parameter in 2 years.

    Required changes for DevTools:

    • Create a helper / getter isVsCode that returns parameters['dashTool'] == 'vscode-plugins' || parameters['ide'] == "VSCode". Use this for:
    • Analytics updates: for consistency, I propose we lean into the dashTool and dashIdeName updates.
      • Deprecate the ideLaunched parameter in the Event.devtoolsEvent constructor: https://github.com/dart-lang/tools/blob/main/pkgs/unified_analytics/lib/src/event.dart#L500
      • Add two new parameters to the Event.devtoolsEvent constructor, dashTool and dashIdeName.
      • Publish the unified_analytics changes and depend on the new package version from DevTools
      • In DevTools where analytics events are constructed, set the values
        • dashTool: parameters['dashTool'] ?? parameters['ide']
        • dashIdeName: parameters['dashIdeName']

    Required changes for dashboards:

    • Where our dashboards slice by IDE, check for ideLaunched = "VSCode" OR dashTool = "vscode-plugins" OR dashTool = "VSCode" and similarly for checks for "Android Studio" or "IntelliJ".
  6. DanTup commented on Apr 29, 2026

    @DanTup
    ContributorAuthor

    Where are these getting sent to the DevTools server and what are the values used for in the server?

    Sorry, what I wrote was perhaps misleading. They are provided to the server in environment variables, but the server does not use them. The env vars we discussed in the Dart-Code PR are being set for all processes spawned by Dart-Code (and I believe @helin24 is doing similar for IntelliJ).

    I'm hopeful that all of the tools will converge on using those same variables/values so we don't have to manage different things for different tools we spawn, and so it'd be nice if where we do need to provide something other than the env vars, the names/values were still consistent (eg. if you know the values of DASH__TOOL in the env vars, you can assume the same values would be in a querystring value named dashTool).

    Your summary all looks good to me, although I think:

    Add special handling if devEnvironments contains "VSCode" that checks the new isVsCode getter: https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/shared/managers/survey.dart#L256

    ... would need to handle IntelliJ too. I would suggest them using the dashTool values instead (either with a mapping from the old IDE values onto the corresponding dashTool values, or we update the explanation the meaning of this to be dashTool values directly - although I don't know if some of this is outside of the DevTools repo?).

  7. helin24 commented on May 8, 2026

    @helin24
    Member

    Here is the tracking issue for IJ: flutter/flutter-intellij#8934

    We currently use a URL including ?Source=IntelliJ, but it sounds like I should change this to ?dashTool=intellij-plugins&dashIdeName=<IntelliJ Community|Android Studio|etc.>

    Is this related to the env var settings? It seems that since we are only surfacing a URL and not starting DevTools here, then there's no opportunity to use the env vars.

  8. DanTup commented on May 8, 2026

    @DanTup
    ContributorAuthor

    @helin24

    (re-posting this, because my original response was slightly misleading, because you quoted Source and not IDE).

    We currently use a URL including ?Source=IntelliJ

    I think this is for the survey, not for DevTools (which uses IDE?).

    For the Survey, I believe we are just changing Source to be the new IDE name (the same value as DASH__IDE_NAME). We're not passing all the different values to the surveys (they're just captured as a string AFAIK).

    But for the DevTools IDE parameter:

    it sounds like I should change this to ?dashTool=intellij-plugins&dashIdeName=<IntelliJ Community|Android Studio|etc.>

    not change, but add as well - because versions of DevTools that haven't been updated will still rely on the IDE value.

    Is this related to the env var settings? It seems that since we are only surfacing a URL and not starting DevTools here, then there's no opportunity to use the env vars.

    Yep, exactly. This is providing the same values to the DevTools front-end (because it doesn't have access to the env vars, and it's not convenient to have to ask the DevTools server for them).

  9. helin24 commented on May 8, 2026

    @helin24
    Member

    Ah got it, thanks for the clarifications. I fixed the PR associated with the previous tracking issue, and here is a new one for opening DevTools: flutter/flutter-intellij#8968

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions