Skip to content

LSP always return unrelated items and too many #42152

@iamcco

Description

@iamcco

This tracker is for issues related to:

  • Analyzer

Info:

  • Flutter version: Flutter 1.17.2 • channel stable • https://github.com/flutter/flutter.git
  • Dart SDK Version (dart --version): Dart VM version: 2.8.3 (stable) (Tue May 26 18:39:38 2020 +0200) on "macos_x64"
  • Uusing MacOSX: 10.15.4

Step to repeoduce issue:

Create flutter project with flutter create xxxname

  • open lib/main.dart add print$ and $ is cursor, then press <ctrl>+<space> to trigger autocomplete
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
  print$
}
....

Then checkout the Dart LSP output channel:

[Trace - 10:51:54 AM] Sending request 'textDocument/completion - (12)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/aioiyuuko/development/followme/lib/main.dart"
    },
    "position": {
        "line": 4,
        "character": 7
    },
    "context": {
        "triggerKind": 1
    }
}


[Trace - 10:51:54 AM] Received response 'textDocument/completion - (12)' in 458ms.
Result: [
    {
        "label": "assert",
        "kind": 14,
        "sortText": "998945",
        "insertText": "assert${1:}",
        "insertTextFormat": 2,
        "textEdit": {
            "range": {
                "start": {
                    "line": 4,
                    "character": 2
                },
                "end": {
                    "line": 4,
                    "character": 7
                }
            },
            "newText": "assert${1:}"
        }
    },
    ......hide 26771 items here
    {
        "label": "Int32()",
        "kind": 4,
        "detail": "() → Int32",
        "sortText": "999997",
        "filterText": "Int32",
        "insertText": "Int32",
        "data": {
            "file": "/Users/aioiyuuko/development/followme/lib/main.dart",
            "offset": 81,
            "libId": 715,
            "displayUri": "dart:wasm",
            "rOffset": 76,
            "rLength": 5
        }
    }

]

The response items (26773 items) are too many, and most of them are unrelated items. This lag autocomplete when coding.

the full response complete items log is here
output.log 10 MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-completionIssues with the analysis server's code completion featuredevexp-serverIssues related to some aspect of the analysis serverlegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions