You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vscoqtop crashes when user checks the first sentence of a document, edits it, and step forward.
The following is tested with coq vesion 8.19.2, vscoq-language-server 2.2.1, default settings, with both the official vscode client and my neovim client.
Reproduction steps
Make a file with the following content.
Definition F (q w e r t y u i o p : nat) : nat := q + w + e + r + t + y + u + i + o + p.
Step forward to check the definition of F:
Delete the q parameter of F:
Attempt to step forward, then vscoqtop crashes and restarts:
Logs from "vscoq.args": [ "-bt", "-vscoq-d", "all" ]
Here are some parts of the log that I think are significant:
vscoqtop initializes and parses the document:
[lspManager , 1521082, 1728110880.677768] Received notification: textDocument/didOpen
[document , 1521082, 1728110880.710514] Parsing more from pos -1
[document , 1521082, 1728110880.710527] Start of parse is: 0
[document , 1521082, 1728110880.710927] Parsed: Definition F (q w e r t y u i o p : nat) : nat :=
q + w + e + r + t + y + u + i + o + p.
[document , 1521082, 1728110880.710970] Start of parse is: 88
[document , 1521082, 1728110880.710982] 1 new sentences
[document , 1521082, 1728110880.710988] 0 new comments
[document , 1521082, 1728110880.710994] Top edit: 0, Doc: , Doc by id:
[document , 1521082, 1728110880.711000] diff:
+ [Definition--F--(--q--w--e--r--t--y--u--i--o--p--:--nat--)--:--nat--:=--q--+--w--+--e--+--r--+--t--+--y--+--u--+--i--+--o--+--p--.]
[lspManager , 1521082, 1728110880.711042] sent: {
"params": {
"uri": "file:///path/to/file.v",
"preparedRange": [],
"processingRange": [],
"processedRange": []
},
"method": "vscoq/updateHighlights",
"jsonrpc": "2.0"
}
vscoqtop receives the first stepForward notification:
[top , 1521082, 1728110904.965704] Main loop event ready: Request , 2 events waiting
[lspManager , 1521082, 1728110904.965728] Received notification: textDocument/didChange
[documentManager , 1521082, 1728110904.965757] APPLYING TEXT EDIT Range (start: (0,14), end: (0,15)) []
[document , 1521082, 1728110904.965779] Parsing more from pos -1
[document , 1521082, 1728110904.965786] Start of parse is: 0
[document , 1521082, 1728110904.966256] Parsed: Definition F (w e r t y u i o p : nat) : nat :=
q + w + e + r + t + y + u + i + o + p.
[document , 1521082, 1728110904.966335] Start of parse is: 87
[document , 1521082, 1728110904.966356] 1 new sentences
[document , 1521082, 1728110904.966363] 0 new comments
[document , 1521082, 1728110904.966383] Top edit: 0, Doc: [Definition--F--(--q--w--e--r--t--y--u--i--o--p--:--nat--)--:--nat--:=--q--+--w--+--e--+--r--+--t--+--y--+--u--+--i--+--o--+--p--.], Doc by id: [Definition--F--(--q--w--e--r--t--y--u--i--o--p--:--nat--)--:--nat--:=--q--+--w--+--e--+--r--+--t--+--y--+--u--+--i--+--o--+--p--.]
[document , 1521082, 1728110904.966399] diff:
- (id: 2) [Definition--F--(--q--w--e--r--t--y--u--i--o--p--:--nat--)--:--nat--:=--q--+--w--+--e--+--r--+--t--+--y--+--u--+--i--+--o--+--p--.]
+ [Definition--F--(--w--e--r--t--y--u--i--o--p--:--nat--)--:--nat--:=--q--+--w--+--e--+--r--+--t--+--y--+--u--+--i--+--o--+--p--.]
[executionManager , 1521082, 1728110904.966419] Invalidating: 2
[lspManager , 1521082, 1728110904.966517] sent: {
"params": {
"uri": "file:///path/to/file.v",
"preparedRange": [],
"processingRange": [],
"processedRange": [
{
"end": { "character": 87, "line": 0 },
"start": { "character": 0, "line": 0 }
}
]
},
"method": "vscoq/updateHighlights",
"jsonrpc": "2.0"
}
[lspManager , 1521082, 1728110904.966580] sent: {
"params": {
"diagnostics": [],
"uri": "file:///path/to/file.v"
},
"method": "textDocument/publishDiagnostics",
"jsonrpc": "2.0"
}
vscoqtop receives the second stepForward and crashes:
[lspManager , 1521082, 1728110949.063774] UI req ready
[top , 1521082, 1728110949.063834] Main loop event ready: Request , 2 events waiting
[lspManager , 1521082, 1728110949.063850] Received notification: vscoq/stepForward
[top , 1521082, 1728110949.063862] ==========================================================
[top , 1521082, 1728110949.063934] Uncaught exception Failure("interpret to next with no observe_id").
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Dune__exe__LspManager.coqtopStepForward in file "vscoqtop/lspManager.ml", line 446, characters 38-105
Called from Dune__exe__LspManager.handle_lsp_event in file "vscoqtop/lspManager.ml", line 656, characters 22-49
Called from Dune__exe__Vscoqtop.loop.loop in file "vscoqtop/vscoqtop.ml", line 28, characters 21-50
Called from Dune__exe__Vscoqtop.loop in file "vscoqtop/vscoqtop.ml", line 33, characters 6-15
[top , 1521082, 1728110949.063945] ==========================================================
[Error - 3:49:09 PM] Server process exited with code 0.
[Info - 3:49:09 PM] Connection to server got closed. Server will restart.
No crash when editing non-first sentences
Make a file with the following content
Definition F1 (q w e r t y u i o p : nat) : nat := q + w + e + r + t + y + u + i + o + p.
Definition F2 (q w e r t y u i o p : nat) : nat := q + w + e + r + t + y + u + i + o + p.
Check up to second setennce, and delete the q parameter from F2.
In this case, the check part retracts properly, and stepping forward does not crash.
vscoqtop crashes when user checks the first sentence of a document, edits it, and step forward.
The following is tested with coq vesion 8.19.2, vscoq-language-server 2.2.1, default settings, with both the official vscode client and my neovim client.
Reproduction steps
Make a file with the following content.
Definition F (q w e r t y u i o p : nat) : nat := q + w + e + r + t + y + u + i + o + p.
Step forward to check the definition of
F
:Delete the
q
parameter ofF
:Attempt to step forward, then vscoqtop crashes and restarts:
Logs from
"vscoq.args": [ "-bt", "-vscoq-d", "all" ]
Here are some parts of the log that I think are significant:
vscoqtop initializes and parses the document:
vscoqtop receives the first
stepForward
notification:vscoqtop receives
didChange
:vscoqtop receives the second
stepForward
and crashes:No crash when editing non-first sentences
Make a file with the following content
Check up to second setennce, and delete the
q
parameter fromF2
.In this case, the check part retracts properly, and stepping forward does not crash.
possible fix
It seems that editting the first sentence sets
observe_id
toNone
, which triggers the crash here.https://github.com/coq-community/vscoq/blob/f13ff1a9f252dc6ac3386e10215605ebec194cae/language-server/dm/documentManager.ml#L381
I believe
observe_id
should be set toSome Top
instead.The text was updated successfully, but these errors were encountered: