Skip to content

Commit

Permalink
fix: stepForward and stepBackward no longer require a position to wor…
Browse files Browse the repository at this point in the history
…k in continuous mode
  • Loading branch information
rtetley committed Dec 3, 2024
1 parent a881fb1 commit 2d8bfff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
24 changes: 2 additions & 22 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,28 +211,8 @@ export function activate(context: ExtensionContext) {
registerVscoqTextCommand('expandAllQueries', () => searchProvider.expandAll());
registerVscoqTextCommand('interpretToPoint', (editor) => sendInterpretToPoint(editor, client));
registerVscoqTextCommand('interpretToEnd', (editor) => sendInterpretToEnd(editor, client));
registerVscoqTextCommand('stepForward', (editor) => {

if(workspace.getConfiguration('vscoq.proof').mode === 1) {
const textDocument = makeVersionedDocumentId(editor);
const position = editor.selection.active;
client.sendNotification("vscoq/stepForward", {textDocument: textDocument, position: position});
}
else {
sendStepForward(editor, client);
}

});
registerVscoqTextCommand('stepBackward', (editor) => {
if(workspace.getConfiguration('vscoq.proof').mode === 1) {
const textDocument = makeVersionedDocumentId(editor);
const position = editor.selection.active;
client.sendNotification("vscoq/stepBackward", {textDocument: textDocument, position: position});
}
else {
sendStepBackward(editor, client);
}
});
registerVscoqTextCommand('stepForward', (editor) => sendStepForward(editor, client));
registerVscoqTextCommand('stepBackward', (editor) => sendStepBackward(editor, client));
registerVscoqTextCommand('documentState', async (editor) => {

documentStateProvider.setDocumentUri(editor.document.uri);
Expand Down
4 changes: 2 additions & 2 deletions client/src/manualChecking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const sendInterpretToEnd = (editor: TextEditor, client: Client) => {

export const sendStepForward = (editor: TextEditor, client: Client) => {
const textDocument = makeVersionedDocumentId(editor);
client.sendNotification("vscoq/stepForward", {textDocument: textDocument, position: null});
client.sendNotification("vscoq/stepForward", {textDocument: textDocument});
};

export const sendStepBackward = (editor: TextEditor, client: Client) => {
const textDocument = makeVersionedDocumentId(editor);
client.sendNotification("vscoq/stepBackward", {textDocument: textDocument, position: null});
client.sendNotification("vscoq/stepBackward", {textDocument: textDocument});
};

2 changes: 0 additions & 2 deletions language-server/protocol/extProtocol.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module Notification = struct

type t = {
textDocument : VersionedTextDocumentIdentifier.t;
position: Position.t option;
} [@@deriving yojson]

end
Expand All @@ -51,7 +50,6 @@ module Notification = struct

type t = {
textDocument : VersionedTextDocumentIdentifier.t;
position: Position.t option;
} [@@deriving yojson]

end
Expand Down
4 changes: 2 additions & 2 deletions language-server/vscoqtop/lspManager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ let coqtopInterpretToPoint params =
sel_events

let coqtopStepBackward params =
let Notification.Client.StepBackwardParams.{ textDocument = { uri }; position } = params in
let Notification.Client.StepBackwardParams.{ textDocument = { uri } } = params in
match Hashtbl.find_opt states (DocumentUri.to_path uri) with
| None -> log "[stepBackward] ignoring event on non existent document"; []
| Some { st; visible } ->
Expand All @@ -410,7 +410,7 @@ let coqtopStepBackward params =
inject_dm_events (uri,events)

let coqtopStepForward params =
let Notification.Client.StepForwardParams.{ textDocument = { uri }; position } = params in
let Notification.Client.StepForwardParams.{ textDocument = { uri } } = params in
match Hashtbl.find_opt states (DocumentUri.to_path uri) with
| None -> log "[stepForward] ignoring event on non existent document"; []
| Some { st; visible } ->
Expand Down

0 comments on commit 2d8bfff

Please sign in to comment.