Skip to content

completion: listing constructors is slow #1836

@Eskibear

Description

@Eskibear

CPU: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz *8 cores
OS: Windows 10
Test project: a simple maven project with no extra dependency
Use case: complete for new constructor

    public String sayHello() {
        new S‸
    }

profiling details:

image

Sample response:

Because my CPU is relative powerful, 263ms is not a small number. It can be up to 1s on my other machines.
one item from completion response:

Received response 'textDocument/completion - (108)' in 263ms.
Result: {
    "isIncomplete": false,
    "items": [
...
{
            "label": "SAXException()",
            "kind": 4,
            "detail": "org.xml.sax.SAXException.SAXException()",
            "sortText": "999999163",
            "insertText": "SAXException",
            "insertTextFormat": 2,
            "textEdit": {
                "range": {
                    "start": {
                        "line": 7,
                        "character": 12
                    },
                    "end": {
                        "line": 7,
                        "character": 13
                    }
                },
                "newText": "SAXException()"
            },
            "data": {
                "decl_signature": "Lorg.xml.sax.SAXException;",
                "signature": "()V",
                "name": "SAXException",
                "pid": "65",
                "rid": "7",
                "uri": "file:///C:/Users/yanzh/Desktop/maven-dependency-conflict-demo-master/project-commmon/src/main/java/projectcommon/HelloWorld.java"
            }
...

response of resolve request:

Received response 'completionItem/resolve - (109)' in 6ms.
Result: {
    "label": "SAXException()",
    "kind": 4,
    "detail": "org.xml.sax.SAXException.SAXException()",
    "documentation": {
        "kind": "markdown",
        "value": "Create a new SAXException."
    },
    "sortText": "999999163",
    "insertTextFormat": 2,
    "textEdit": {
        "range": {
            "start": {
                "line": 7,
                "character": 12
            },
            "end": {
                "line": 7,
                "character": 13
            }
        },
        "newText": "SAXException()"
    },
    "additionalTextEdits": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 22
                },
                "end": {
                    "line": 2,
                    "character": 0
                }
            },
            "newText": "\n\nimport org.xml.sax.SAXException;\n\n"
        }
    ]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions