Remove some trigger characters from LSP code completion

These trigger too often are an annoyance. Until we can handle them with context, they should be removed.

Change-Id: I77618eb6228177c509b5bc0de51f758efdbdb12b
Reviewed-on: https://dart-review.googlesource.com/c/90401
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
index 5b47079..67ab08f 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_initialize.dart
@@ -60,10 +60,25 @@
           false,
           // Set the characters that will cause the editor to automatically
           // trigger completion.
-          // TODO(dantup): This is quite eager and may need filtering in the
-          // completion handler.
-          // See https://github.com/Dart-Code/Dart-Code/blob/c616c93c87972713454eb0518f97c0278201a99a/src/providers/dart_completion_item_provider.ts#L36
-          r'''.: =(${'"/\'''.split(''),
+          // TODO(dantup): There are several characters that we want to conditionally
+          // allow to trigger completion, but they can only be added when the completion
+          // provider is able to handle them in context:
+          //
+          //    {   trigger if being typed in a string immediately after a $
+          //    '   trigger if the opening quote for an import/export
+          //    "   trigger if the opening quote for an import/export
+          //    /   trigger if as part of a path in an import/export
+          //    \   trigger if as part of a path in an import/export
+          //    :   don't trigger when typing case expressions (`case x:`)
+          //
+          // Additionally, we need to prefix `filterText` on completion items
+          // with spaces for those that can follow whitespace (eg. `foo` in
+          // `myArg: foo`) to ensure they're not filtered away when the user
+          // types space.
+          //
+          // See https://github.com/Dart-Code/Dart-Code/blob/68d1cd271e88a785570257d487adbdec17abd6a3/src/providers/dart_completion_item_provider.ts#L36-L64
+          // for the VS Code implementation of this.
+          r'''.=($'''.split(''),
         ),
         new SignatureHelpOptions(
           // TODO(dantup): Signature help triggering is even more sensitive to