Skip to content

Commit

Permalink
set default values for limit and with_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
PizieDust committed Oct 23, 2024
1 parent a0d18a0 commit 263c617
Showing 1 changed file with 6 additions and 42 deletions.
48 changes: 6 additions & 42 deletions src/extension_commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ module Search_by_type = struct
~f:(fun (res : Custom_requests.Type_search.type_search_result) ->
( Vscode.QuickPickItem.create
~label:res.name
~description:res.constructible
~description:res.typ
~detail:(Option.value ~default:"" res.doc)
()
, res.name )))
Expand Down Expand Up @@ -607,7 +607,7 @@ module Search_by_type = struct
let position =
TextEditor.selection text_editor |> Selection.active
in
let* get_query_input =
let* query_input =
Vscode.(
Window.showInputBox
~options:
Expand All @@ -623,49 +623,13 @@ module Search_by_type = struct
())
())
in
let* get_doc_input =
Vscode.(
Window.showQuickPickItems
~choices:
[ ( QuickPickItem.create ~label:"Yes" ~alwaysShow:false ()
, "yes" )
; ( QuickPickItem.create ~label:"No" ~alwaysShow:false ()
, "no" )
]
~options:
(QuickPickOptions.create
~title:"Search By Type"
~matchOnDescription:false
~canPickMany:false
~placeHolder:
"Documentation information will be attached for each \
result."
~ignoreFocusOut:true
())
())
in
let* get_limit_input =
Vscode.(
Window.showInputBox
~options:
(InputBoxOptions.create
~title:"Search By Type"
~prompt:"How many results should be returned"
~placeHolder:"20"
~value:"20"
~password:false
~ignoreFocusOut:true
())
())
in
match (get_query_input, get_doc_input, get_limit_input) with
| Some query, Some with_doc, Some limit -> (
match query_input with
| Some query -> (
let* type_search_results =
get_search_results
~query
~with_doc:(String.equal with_doc "yes")
~limit:
(Option.value ~default:50 (Stdlib.int_of_string_opt limit))
~with_doc:true
~limit:100
~position
text_editor
client
Expand Down

0 comments on commit 263c617

Please sign in to comment.