@@ -62,17 +62,6 @@ function setupMethods (soljson) {
62
62
soljson . setValue ( ptr , buffer , '*' ) ;
63
63
} ;
64
64
65
- const createWrappedLspSend = function ( ) {
66
- if ( ! ( '_solidity_lsp_send' in soljson ) )
67
- return null ;
68
- const wrappedLspSend = soljson . cwrap ( 'solidity_lsp_send' , 'number' , [ 'string' ] ) ;
69
- return function ( input : String ) {
70
- const args = [ ] ;
71
- args . push ( JSON . stringify ( input ) ) ;
72
- return wrappedLspSend . apply ( undefined , args ) ;
73
- } ;
74
- } ;
75
-
76
65
// Creates a wrapper around `int solidity_lsp_start(callbacks: Callbacks)`.
77
66
const createWrappedLspStart = function ( ) {
78
67
if ( ! ( '_solidity_lsp_start' in soljson ) )
@@ -118,6 +107,36 @@ function setupMethods (soljson) {
118
107
} ;
119
108
} ;
120
109
110
+ // C signature : int solidity_lsp_send(char const* jsonRpcInputObject);
111
+ // TS signature : int send(object jsonRpcInputObject);
112
+ const createWrappedLspSend = function ( ) {
113
+ if ( ! ( '_solidity_lsp_send' in soljson ) )
114
+ return null ;
115
+ const wrappedLspSend = soljson . cwrap ( 'solidity_lsp_send' , 'number' , [ 'string' ] ) ;
116
+ return function ( input : String ) {
117
+ const args = [ ] ;
118
+ args . push ( JSON . stringify ( input ) ) ;
119
+ return wrappedLspSend . apply ( undefined , args ) ;
120
+ } ;
121
+ } ;
122
+
123
+ // C signature : char* solidity_lsp_send_receive(char const* jsonRpcInputObject);
124
+ // TS signature : object sendReceive(object jsonRpcInputObject);
125
+ //
126
+ // sendReceive send one message to the LSP server (notification or method call).
127
+ // The method call may reply with zero or one message that is going to be returned.
128
+ const createWrappedLspSendReceive = function ( ) {
129
+ if ( ! ( '_solidity_lsp_send_receive' in soljson ) )
130
+ return null ;
131
+ const wrappedLspSendReceive = soljson . cwrap ( 'solidity_lsp_send_receive' , 'string' , [ 'string' ] ) ;
132
+ return function ( input : String ) {
133
+ const args = [ ] ;
134
+ args . push ( JSON . stringify ( input ) ) ;
135
+ const reply = wrappedLspSendReceive . apply ( undefined , args ) ;
136
+ return JSON . parse ( reply ) ;
137
+ } ;
138
+ } ;
139
+
121
140
// This is to support multiple versions of Emscripten.
122
141
// Take a single `ptr` and returns a `str`.
123
142
const copyFromCString = soljson . UTF8ToString || soljson . Pointer_stringify ;
@@ -384,7 +403,8 @@ function setupMethods (soljson) {
384
403
} ,
385
404
lsp : {
386
405
start : createWrappedLspStart ( ) ,
387
- sendReceive : createWrappedLspSend ( )
406
+ send : createWrappedLspSend ( ) ,
407
+ sendReceive : createWrappedLspSendReceive ( )
388
408
} ,
389
409
compile : compileStandardWrapper ,
390
410
// Loads the compiler of the given version from the github repository
0 commit comments