Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ocamllabs/vscode-ocaml-platform i…
Browse files Browse the repository at this point in the history
…nto search_t
  • Loading branch information
PizieDust committed Oct 21, 2024
2 parents 999cb56 + 9d4868f commit cbd4e8a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1230,11 +1230,11 @@
"@biomejs/biome": "1.9.4",
"@tsconfig/node22": "22.0.0",
"@tsconfig/strictest": "2.0.5",
"@types/node": "22.7.6",
"@types/node": "22.7.7",
"@types/vscode": "1.86.0",
"@vscode/test-cli": "0.0.10",
"@vscode/test-electron": "2.4.1",
"@vscode/vsce": "3.1.1",
"@vscode/vsce": "3.2.0",
"esbuild": "0.24.0",
"ovsx": "0.10.0",
"typescript": "5.6.3"
Expand Down
7 changes: 3 additions & 4 deletions src/custom_requests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let typedHoles =
}

module Type_enclosing = struct
type request_params =
type params =
{ uri : Uri.t
; at : [ `Position of Position.t | `Range of Range.t ]
; index : int
Expand Down Expand Up @@ -68,11 +68,10 @@ module Type_enclosing = struct
let enclosings = field "enclosings" (list Range.t_of_json) response in
{ index; type_; enclosings }

let make ~uri ~at ~index ~verbosity = { uri; at; index; verbosity }

let request =
{ meth = ocamllsp_prefixed "typeEnclosing"; encode_params; decode_response }

let send ~uri ~at ~index ~verbosity client =
send_request client request { uri; at; index; verbosity }
end

module Type_search = struct
Expand Down
9 changes: 6 additions & 3 deletions src/custom_requests.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ val inferIntf : (string, string) custom_request
val typedHoles : (Uri.t, Range.t list) custom_request

module Type_enclosing : sig
type params

type response =
{ index : int
; type_ : string
; enclosings : Range.t list
}

val send :
val make :
uri:Uri.t
-> at:[ `Position of Position.t | `Range of Range.t ]
-> index:int
-> verbosity:int
-> LanguageClient.t
-> response Promise.t
-> params

val request : (params, response) custom_request
end

module Type_search : sig
Expand Down
15 changes: 9 additions & 6 deletions src/extension_commands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,15 @@ module Copy_type_under_cursor = struct
let doc = TextEditor.document text_editor in
let uri = TextDocument.uri doc in
let selection = TextEditor.selection text_editor in
Custom_requests.Type_enclosing.send
~uri
~at:(`Range (Selection.to_range selection))
~index:0
~verbosity:0
client
Custom_requests.(
send_request
client
Type_enclosing.request
(Type_enclosing.make
~uri
~at:(`Range (Selection.to_range selection))
~index:0
~verbosity:0))

let _copy_type_under_cursor =
let handler (instance : Extension_instance.t) ~args:_ =
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1639,12 +1639,12 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:22.7.6":
version: 22.7.6
resolution: "@types/node@npm:22.7.6"
"@types/node@npm:22.7.7":
version: 22.7.7
resolution: "@types/node@npm:22.7.7"
dependencies:
undici-types: "npm:~6.19.2"
checksum: 10c0/d4406a63afce981c363fb1d1954aaf1759ad2d487c0833ebf667565ea4e45ff217d6fab4b5343badbdeccdf9d2e4a0841d633e0c929ceabcb33c288663dd0c73
checksum: 10c0/07268a1e990ad9d9b1865092881317ea679a46eb6706d83a8874eec75fdddae6cfd6452e4e68b651561183e2a8f8548276f3155744bc402c2545978c19b70d65
languageName: node
linkType: hard

Expand Down Expand Up @@ -1793,9 +1793,9 @@ __metadata:
languageName: node
linkType: hard

"@vscode/vsce@npm:3.1.1":
version: 3.1.1
resolution: "@vscode/vsce@npm:3.1.1"
"@vscode/vsce@npm:3.2.0":
version: 3.2.0
resolution: "@vscode/vsce@npm:3.2.0"
dependencies:
"@azure/identity": "npm:^4.1.0"
"@vscode/vsce-sign": "npm:^2.0.0"
Expand Down Expand Up @@ -1827,7 +1827,7 @@ __metadata:
optional: true
bin:
vsce: vsce
checksum: 10c0/f583457bf1f7e51f0d79c45895e47f559dab1fcdc192e7053df96e6891743112ed4d0fa29830774ba04fabe55da7f262c1805fe35ceca93b04b965b2935c8e3e
checksum: 10c0/2a208a0d8a039e47d41af46ed9cb8b37f360507036c1118493d44a7f1c31506c5e78b179a868406d34b9e1ec12140078b898d3f25f291cbe85698e4f06ec30a9
languageName: node
linkType: hard

Expand Down Expand Up @@ -4593,11 +4593,11 @@ __metadata:
"@biomejs/biome": "npm:1.9.4"
"@tsconfig/node22": "npm:22.0.0"
"@tsconfig/strictest": "npm:2.0.5"
"@types/node": "npm:22.7.6"
"@types/node": "npm:22.7.7"
"@types/vscode": "npm:1.86.0"
"@vscode/test-cli": "npm:0.0.10"
"@vscode/test-electron": "npm:2.4.1"
"@vscode/vsce": "npm:3.1.1"
"@vscode/vsce": "npm:3.2.0"
esbuild: "npm:0.24.0"
ovsx: "npm:0.10.0"
polka: "npm:1.0.0-next.28"
Expand Down

0 comments on commit cbd4e8a

Please sign in to comment.