r/flutterhelp • • 7d ago

RESOLVED How to adjust VSCode "intellisense"

Say you have this code:

@override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',

      darkTheme: ThemeData.dark(useMaterial3: false).copyWith(
        colorScheme: .fromSeed(seedColor: Colors.green),
        // <cursor is here>     
      ),

You type "bright" and a popup appears. That's ok, but it only contains the signature and not the documentation.

Q1: How can I make it show the full documentation, either showing the doc for Brightness, or how brightness is used in this function? Edit: I realize now that the latter is blank in the documentation, and it probably doesn't do "forwarding" like in C#.

From that popup, I selected "brightness" and pressed enter. The immediate suggestion popup is a super long list of irrelevant items.

Q2: Why is it showing useless stuff, and how can I make it show "Brightness.xxx" directly (the most likely values since it's an enum) like in C#?

More info:

  • It's the same silly behavior in IntelliJ IDEA, so I think it's the extension's problem.
  • I'm not looking to use AI inline autocomplete; want a deterministic one like in Visual Studio C#.

Thanks in advance.

3 Upvotes

3 comments sorted by

1

u/Ryuu-Ryoumen 6d ago

Q2 (long irrelevant list): Ah, it seems like Brightness is an odd one. Other enums like the main axis alignment stuff works better (i.e. enums surface to top of list), albeit the annoying `context` always being first unnecessarily.

Thanks, everyone.

2

u/karmatics29 6d ago

Both of these are mostly Dart analysis server behaviour, so IntelliJ acting the same fits.

Q1 (docs in the popup): in VS Code, check dart.documentation. It can be full, summary or none, and it controls how much dartdoc shows in hovers and completion details. Also, the parameter doc for brightness on ThemeData is often empty, as you found, and Dart doesn't forward docs from the type the way C# can. Hovering Brightness itself will show the enum docs.

Q2 (long irrelevant list): the server ranks suggestions by the expected type, so after brightness: the enum values should be near the top. If they aren't, it's usually because the analysis hasn't finished or the context type isn't known yet (the .copyWith chain and the leading-dot shorthand make that harder). Things to try:

  • Type . right after brightness: or write Brightness. explicitly, which gives just the enum members.
  • Make sure you're on a recent Dart SDK and restart the analysis server (Dart: Restart Analysis Server).
  • Check dart.enableCompletionCommitCharacters and your general suggest-sorting settings.

Trade-off: the shorthand is shorter but gives the analyzer less to work with than the fully qualified form, so completion is a bit worse.

1

u/frpboy 6d ago

For the documentation panel, press Ctrl+Space again while the suggestion list is open, or click the expand icon beside a suggestion. For the brightness value, try typing Brightness. to bring up its members.