AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
226 stars 54 forks source link

Request failed: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null token argument) (-32603). #1169

Closed NickFoubert closed 7 months ago

NickFoubert commented 7 months ago

Using Language Support for Ada VS code extension v24.0.1 with VS code 1.84.1, I'm very frequently getting Request failed: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null token argument) (-32603). and pop-up alert.

Ouput using verbose settings (in this case I typed the final 'h' character in a 'with'):

[Trace - 5:48:35 PM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file:///workspaces/dds-discovery/src/discovery.adb",
        "version": 14
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 3
                },
                "end": {
                    "line": 0,
                    "character": 3
                }
            },
            "rangeLength": 0,
            "text": "h"
        }
    ]
}

[Trace - 5:48:35 PM] Sending request 'textDocument/completion - (58)'.
Params: {
    "textDocument": {
        "uri": "file:///workspaces/dds-discovery/src/discovery.adb"
    },
    "position": {
        "line": 0,
        "character": 4
    },
    "context": {
        "triggerKind": 1
    }
}

[Trace - 5:48:35 PM] Received response 'textDocument/completion - (58)' in 23ms. Request failed: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null token argument) (-32603).
[Error - 5:48:35 PM] Request textDocument/completion failed.
  Message: Exception: LANGKIT_SUPPORT.ERRORS.PRECONDITION_FAILURE (null token argument)
  Code: -32603 
[Trace - 5:48:35 PM] Sending request 'textDocument/codeAction - (59)'.
Params: {
    "textDocument": {
        "uri": "file:///workspaces/dds-discovery/src/discovery.adb"
    },
    "range": {
        "start": {
            "line": 0,
            "character": 4
        },
        "end": {
            "line": 0,
            "character": 4
        }
    },
    "context": {
        "diagnostics": []
    }
}

[Trace - 5:48:35 PM] Received response 'textDocument/codeAction - (59)' in 3ms.
No result returned.

[Trace - 5:48:35 PM] Sending request 'textDocument/foldingRange - (60)'.
Params: {
    "textDocument": {
        "uri": "file:///workspaces/dds-discovery/src/discovery.adb"
    }
}

[Trace - 5:48:35 PM] Received response 'textDocument/foldingRange - (60)' in 2ms.
Result: [
    {
        "startLine": 1,
        "endLine": 4,
        "kind": "region"
    }
]

[Trace - 5:48:35 PM] Sending request 'textDocument/semanticTokens/full - (61)'.
Params: {
    "textDocument": {
        "uri": "file:///workspaces/dds-discovery/src/discovery.adb"
    }
}

[Trace - 5:48:35 PM] Sending request 'textDocument/documentSymbol - (62)'.
Params: {
    "textDocument": {
        "uri": "file:///workspaces/dds-discovery/src/discovery.adb"
    }
}

[Trace - 5:48:35 PM] Received response 'textDocument/semanticTokens/full - (61)' in 4ms.
Result: {
    "data": [
        1,
        10,
        9,
        11,
        1,
        3,
        4,
        9,
        11,
        0
    ]
}

[Trace - 5:48:35 PM] Received response 'textDocument/documentSymbol - (62)' in 21ms.
Result: [
    {
        "name": "Discovery",
        "kind": 12,
        "range": {
            "start": {
                "line": 1,
                "character": 0
            },
            "end": {
                "line": 4,
                "character": 14
            }
        },
        "selectionRange": {
            "start": {
                "line": 1,
                "character": 10
            },
            "end": {
                "line": 1,
                "character": 19
            }
        },
        "alsIsDeclaration": false,
        "alsIsAdaProcedure": true,
        "alsVisibility": 1
    }
]

The project is setup with Alire and the plugin seems to index the project properly, but I have included the project file explicitly in the Project File setting just in case.

NickFoubert commented 7 months ago

I just reverted to v23.0.21 and that problem no longer happens.

yannickmoy commented 7 months ago

I was also getting this message, for example when the cursor is on the last line character of a file which is not an empty line. And reverting to v23.0.21 indeed fixed it.

AnthonyLeonardoGracio commented 7 months ago

Hello! We have fixed this issue. The fix will be included in the next extension's release.

Regards,

reznikmm commented 7 months ago

This is fixed in 24.0.2. You can fetch it from OpenVSIX. Unfortunately, it wasn't published on the Marketplace, because of conflict in the updated display name.