Skip to content

Is the position in textDocument/completion guaranteed to be valid? #946

@davidanthoff

Description

@davidanthoff

We are seeing crash reports for our Julia extension where we get textDocument/completion requests for positions that don't exist in the document. For example, the document is empty (i.e. an empty string), and then we get a request with a position of line 4 character 11.

We did have some bugs in terms of text sync. They previously showed up when we compared our own copy of the document content with the value we received in didSave. But we haven't received a single a single crash report with this kind of discrepancy in didSave so we kind of assume that we fixed the text sync... (we have automatic crash reporting and many thousand users, so we should have pretty good coverage).

The question for us now is: is this another bug in our text sync implementation, or should we expect to get textDocument/completion requests for positions that don't exist? Or is this maybe a bug in what positions are sent from the VS Code client?

Looking at the node implementation here it looks like it would just tolerate such erroneous position requests, i.e. even if a request with a position that doesn't exist came in, it would not crash. So maybe the VS Code client is sending these positions that are not really valid, but it hasn't shown up as bugs because the "default" implementation can ignore this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    info-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions