@@ -49,10 +49,6 @@ export class DartCompletionItemProvider implements CompletionItemProvider {
4949 case "\\" :
5050 return line . startsWith ( "import \"" ) || line . startsWith ( "export \"" )
5151 || line . startsWith ( "import '" ) || line . startsWith ( "export '" ) ;
52- // Only trigger on spaces in arg lists, not on the space between parens and braces
53- // of a function definition (#1256).
54- case " " :
55- return line . endsWith ( "," ) || line . endsWith ( ":" ) ;
5652 // Don't trigger for colons if we're in a case statement
5753 case ":" :
5854 return ! line . startsWith ( "case" ) ;
@@ -174,7 +170,11 @@ export class DartCompletionItemProvider implements CompletionItemProvider {
174170
175171 const completion = new CompletionItem ( label , kind ) ;
176172 completion . label = label ;
177- completion . filterText = label . split ( "(" ) [ 0 ] ; // Don't ever include anything after a ( in filtering.
173+ // Always prefix filterText with a space, so completion doesn't filter it out
174+ // if the user types whitespace, eg. in:
175+ // func(foo: bar);
176+ // the colon is the trigger, but we want the list to remain when the user hits space.
177+ completion . filterText = " " + label . split ( "(" ) [ 0 ] ; // Don't ever include anything after a ( in filtering.
178178 completion . kind = kind ;
179179 completion . detail = ( suggestion . isDeprecated ? "(deprecated) " : "" ) + detail ;
180180 completion . documentation = new MarkdownString ( cleanDartdoc ( suggestion . docSummary ) ) ;
@@ -207,7 +207,7 @@ export class DartCompletionItemProvider implements CompletionItemProvider {
207207 // 555 -> 999455
208208 // 10 -> 999990
209209 // 1 -> 999999
210- completion . sortText = ( 1000000 - suggestion . relevance ) . toString ( ) ;
210+ completion . sortText = ( 1000000 - suggestion . relevance ) . toString ( ) + label . trim ( ) ;
211211 return completion ;
212212 }
213213
0 commit comments