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
Completion list looks like something is missing when trailing commas are added to arguments #319
in flutterRelates to running Flutter appsis bugis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
I noticed that we don't show the type of what the parameter expects, when trying to complete a named parameter in constructors. Notice the blank space and then comma after "onTap":
Can we show something like: onTap: void Function(), which is more helpful than showing onTap: GestureTapCallback because, what is a GestureTapCallback? :)
@sethladd What do you mean by label? In GH? Not really; I only have some basic labels; there aren't really enough cases that they need breaking into small categories.
This text is actually how we get it from the analyzer:
However there is a bug in Dart Code that we normally put a placeholder into the completion, but it's only triggered when the completion ends with : (it doesn't consider the trailing comma). I'll fix this, which will add the placeholder but as far as I can see, it still seems I don't have the info you want (for example for onTapUp I know it's a GestureTapUpCallback but not what that is).
I'll make this fix and then post a screenshot of how it works, and then maybe it's worth raising an issue @ sdk for surfacing the actual type of the function required.
@bwilkersonWhile testing some changes for this, I noticed that in a Dart project I only ever get completions for name parameters end with : but in a Flutter project I get them back with : , on the end. The SDKs are very slightly different versions but this seems like a strange change. Is this a deliberate change made between 1.24.0-dev.6.7 and 1.24.0-dev.6.8 or could this be a bug?
See #319 (comment), I can repro the differences on same SDK so I've raised cases in sdk for both the weird commas and a request for the original request here.
Ok, I was a little confused by this. I think there are two issues, however I don't think the type is missing.. In your screenshot you've opened the "details" pane (Ctrl+Space) which moves the type from the completion list to where it is in yours. Here's what it would normally look like:
So I think there are two issues:
There's a weird comma appearing when completing arguments on GestureDetector (I can't repro this by copy/pasting the definition!) which I think should not be there.
Showing the name of the type-def is less useful than showing the underlying type.
I think both of these things may be Analyzer issues, but I'm gonna do some more investigation.
However, as a result of this case I did make a bunch of other minor improvements to the completion (#323, #324).
It seems like both of the problems described here would require analyzer changes. I've raised two cases over at the SDK repo:
dart-lang/sdk#29909 - Unexpected commas on the end of argument completion for GestureDetector (bug?) dart-lang/sdk#29910 - Provide more information for TypeDefs in completions from analyzer (feature req?)
I can't really explain the first one (I can't repro the commas with my own classes, but do see them for GestureDetector in same project!).
Seems like the commas being inserted are by-design - see dart-lang/sdk#29909. I don't really agree with this though, I think it's wonky for many reasons and really don't understand the advantages. I'm tempted to strip them out client-side :/
Ah, yeah. Interesting that the AS is inserting the comma.
The commas are basically required, because they are the signal to the formatter: "format this with more tree-like indention", which is very helpful for Flutter developers.
@sethladd Since you raised this originally; what are your thoughts on me hiding the trailing comma in the completion list (it would still be inserted into the document)? IMO it totally looks like a bug in your screenshot even though I'm come around (somewhat) to the behaviour (I still think it's inconsistent, but there's discussion about that in the sdk issue!).
The pro of hiding the comma is that it doesn't look buggy, but the con is that the completion items don't perfectly show you what would be inserted (it's hard to know if that'd be a big deal to people).
changed the title [-]Missing function type when code-completing named parameters that expect functions[/-][+]Completion list looks like something is missing when trailing commas are added to arguments[/+]on Jul 6, 2017
in flutterRelates to running Flutter appsis bugis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
Activity
sethladd commentedon Jun 16, 2017
BTW do you have a label for "code completion" ?
DanTup commentedon Jun 16, 2017
@sethladd What do you mean by label? In GH? Not really; I only have some basic labels; there aren't really enough cases that they need breaking into small categories.
DanTup commentedon Jun 16, 2017
This text is actually how we get it from the analyzer:
However there is a bug in Dart Code that we normally put a placeholder into the completion, but it's only triggered when the completion ends with
:(it doesn't consider the trailing comma). I'll fix this, which will add the placeholder but as far as I can see, it still seems I don't have the info you want (for example foronTapUpI know it's aGestureTapUpCallbackbut not what that is).I'll make this fix and then post a screenshot of how it works, and then maybe it's worth raising an issue @ sdk for surfacing the actual type of the function required.
DanTup commentedon Jun 16, 2017
@bwilkerson
While testing some changes for this, I noticed that in a Dart project I only ever get completions for name parameters end with:but in a Flutter project I get them back with: ,on the end. The SDKs are very slightly different versions but this seems like a strange change. Is this a deliberate change made between1.24.0-dev.6.7and1.24.0-dev.6.8or could this be a bug?See #319 (comment), I can repro the differences on same SDK so I've raised cases in sdk for both the weird commas and a request for the original request here.
DanTup commentedon Jun 16, 2017
Ok, I was a little confused by this. I think there are two issues, however I don't think the type is missing.. In your screenshot you've opened the "details" pane (
Ctrl+Space) which moves the type from the completion list to where it is in yours. Here's what it would normally look like:So I think there are two issues:
I think both of these things may be Analyzer issues, but I'm gonna do some more investigation.
However, as a result of this case I did make a bunch of other minor improvements to the completion (#323, #324).
DanTup commentedon Jun 16, 2017
It seems like both of the problems described here would require analyzer changes. I've raised two cases over at the SDK repo:
dart-lang/sdk#29909 - Unexpected commas on the end of argument completion for GestureDetector (bug?)
dart-lang/sdk#29910 - Provide more information for TypeDefs in completions from analyzer (feature req?)
I can't really explain the first one (I can't repro the commas with my own classes, but do see them for
GestureDetectorin same project!).sethladd commentedon Jun 19, 2017
Thanks for taking a look!
DanTup commentedon Jun 19, 2017
Seems like the commas being inserted are by-design - see dart-lang/sdk#29909. I don't really agree with this though, I think it's wonky for many reasons and really don't understand the advantages. I'm tempted to strip them out client-side :/
sethladd commentedon Jun 21, 2017
Ah, yeah. Interesting that the AS is inserting the comma.
The commas are basically required, because they are the signal to the formatter: "format this with more tree-like indention", which is very helpful for Flutter developers.
DanTup commentedon Jun 23, 2017
@sethladd Since you raised this originally; what are your thoughts on me hiding the trailing comma in the completion list (it would still be inserted into the document)? IMO it totally looks like a bug in your screenshot even though I'm come around (somewhat) to the behaviour (I still think it's inconsistent, but there's discussion about that in the sdk issue!).
The pro of hiding the comma is that it doesn't look buggy, but the con is that the completion items don't perfectly show you what would be inserted (it's hard to know if that'd be a big deal to people).
[-]Missing function type when code-completing named parameters that expect functions[/-][+]Completion list looks like something is missing when trailing commas are added to arguments[/+]DanTup commentedon Jul 7, 2017
Due to no responses, I've made a call on this! I've trimmed the commas from the display text so everything looks normal:
But when you insert, you still get the original text including the comma (and the placeholder I injected):
I haven't used it much, but in a quick test this looks and feels really natural.