Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCaml earlybird debugger #1148

Merged
merged 37 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a8377fe
Add debug adapter to vscode bindings
sim642 Jun 20, 2023
4f0cdc2
Import metadata from earlybird
sim642 Jun 20, 2023
cc64062
Port parts of earlybird extension
sim642 Jun 20, 2023
795b752
Implement variableGotoClosureCodeLocation command in debugger
sim642 Jun 22, 2023
9fff993
Implement startDebug command in debugger
sim642 Jun 22, 2023
c64e416
Rename debugger to ocaml.earlybird
sim642 Jun 22, 2023
7deac33
Rename Debugger -> Earlybird
sim642 Jun 22, 2023
54ab258
Refactor Earlybird
sim642 Jun 22, 2023
e5f6ea9
Improve debug debug adapter types
sim642 Jun 22, 2023
89fe841
Refactor earlybird code
sim642 Jun 22, 2023
8d9a205
Simplify debugger configurations
sim642 Jun 22, 2023
4642df3
Remove unused noDebug from debugger
sim642 Jun 22, 2023
66a950a
Use full language IDs for breakpoints
sim642 Jun 22, 2023
5db1408
Rename earlybird commands
sim642 Jun 22, 2023
a6034db
Remove unnecessary earlybird configuration options
sim642 Jun 22, 2023
8c35503
Simplify start-debugging configuration
sim642 Jun 22, 2023
6c3e538
Make startDebugging type more precise
sim642 Jun 22, 2023
3eed2cc
Clean up goto-closure-code-location
sim642 Jun 22, 2023
6593ab4
Clean up start-debugging
sim642 Jun 23, 2023
d7a823a
Fix variableGetClosureCodeLocation decoding
sim642 Jun 23, 2023
bc56b2d
Fix showTextDocument overloads
sim642 Jun 23, 2023
4b5ffd2
Add earlybird to CHANGELOG
sim642 Jun 23, 2023
83c3799
Mention earlybird integration being expermental
sim642 Jun 23, 2023
06acadb
Remove ignore in Earlybird
sim642 Jun 29, 2023
387e87c
Add DebugConfiguration API
sim642 Jun 29, 2023
3587cd6
Use DebugConfiguration API in Extension_commands
sim642 Jun 29, 2023
df50968
Refactor DebugAdapterDescriptor API
sim642 Jun 29, 2023
81b968b
Format earlybird entry in CHANGELOG
sim642 Jun 29, 2023
1f65a5a
Support custom sandbox in Earlybird
sim642 Jun 30, 2023
7a2f76a
Replace a.out in default earlybird configuration
sim642 Jul 4, 2023
da6b9be
Add Earlybird module interface
sim642 Jul 8, 2023
10be2a5
Add ocaml.ask-debug-program command to initial debug configuration
sim642 Jul 9, 2023
f4b5fb6
Add earlybird configuration snippet
sim642 Jul 9, 2023
bd5ba01
Add stopOnEntry to automatic debug configurations
sim642 Jul 9, 2023
13595c9
Add earlybird to README
sim642 Jul 9, 2023
8e684e6
Only leave .bc for earlybird
sim642 Jul 9, 2023
a205b96
Add earlybird availability check
sim642 Jul 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src-bindings/vscode/vscode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2978,15 +2978,14 @@ module Window = struct
[@@js.get "vscode.window.onDidCloseTerminal"]

val showTextDocument :
document:
([ `TextDocument of TextDocument.t | `Uri of Uri.t ][@js.union])
document:TextDocument.t
-> ?column:ViewColumn.t
-> ?preserveFocus:bool
-> unit
-> TextEditor.t Promise.t
[@@js.global "vscode.window.showTextDocument"]

val showTextDocument2 :
val showTextDocument' :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you describe the issue this commit is fixing? I think also putting it in a separate PR would be valuable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In VSCode extension API showTextDocument has a couple of overloads. Specifically the cases without TextDocumentShowOptions only take TextDocument arguments, not Uri: https://code.visualstudio.com/api/references/vscode-api#window.showTextDocument.

I think there wasn't a problem before because the Uri overload is not used by OCaml Platform.

document:
([ `TextDocument of TextDocument.t | `Uri of Uri.t ][@js.union])
-> ?options:TextDocumentShowOptions.t
Expand Down
6 changes: 3 additions & 3 deletions src-bindings/vscode/vscode.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2283,14 +2283,14 @@ module Window : sig
val onDidCloseTerminal : unit -> Terminal.t Event.t

val showTextDocument :
document:[ `TextDocument of TextDocument.t | `Uri of Uri.t ]
document:TextDocument.t
-> ?column:ViewColumn.t
-> ?preserveFocus:bool
-> unit
-> TextEditor.t Promise.t

val showTextDocument2 :
document:([ `TextDocument of TextDocument.t | `Uri of Uri.t ][@js.union])
val showTextDocument' :
document:[ `TextDocument of TextDocument.t | `Uri of Uri.t ]
-> ?options:TextDocumentShowOptions.t
-> unit
-> TextEditor.t Promise.t
Expand Down
5 changes: 1 addition & 4 deletions src/ast_editor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,7 @@ let open_pp_doc instance ~document =
~pp_doc_uri:(TextDocument.uri doc);
replace_document_content ~content:pp_pp_str ~document:doc;
let+ (_ : TextEditor.t) =
Window.showTextDocument
~document:(`TextDocument doc)
~column:ViewColumn.Beside
()
Window.showTextDocument ~document:doc ~column:ViewColumn.Beside ()
in
Ok ()

Expand Down
2 changes: 1 addition & 1 deletion src/extension_commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ end = struct
range
in
let+ _ =
Window.showTextDocument2
Window.showTextDocument'
~document:(`TextDocument text_document)
~options:
(TextDocumentShowOptions.create ~preview:true ~selection ())
Expand Down
4 changes: 2 additions & 2 deletions src/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ let log_value msg (js_val : Ojs.t) = log_json msg (Jsonoo.t_of_js js_val)
let open_file_in_text_editor target_uri =
let open Promise.Syntax in
let uri = Uri.parse target_uri () in
let* doc =
let* document =
Workspace.openTextDocument (`Uri uri)
|> Promise.catch ~rejected:(fun (_ : Promise.error) ->
(* if file does not exist *)
let create_file_uri = Uri.with_ uri ~scheme:`Untitled () in
let+ doc = Workspace.openTextDocument (`Uri create_file_uri) in
doc)
in
let+ text_editor = Window.showTextDocument ~document:(`TextDocument doc) () in
let+ text_editor = Window.showTextDocument ~document () in
text_editor

let with_confirmation message ~yes ?(no = "Cancel") f =
Expand Down