@@ -265,41 +265,41 @@ const Arguments: React.FC<ArgumentsProps> = (props) => {
265265 const { name, type } = arg ;
266266 let value = values [ name ] ;
267267
268+ if ( type === `String` ) {
269+ value = `${ value } ` ;
270+ }
271+
268272 // We probably better fix this on server side...
269273 if ( type === 'UFix64' ) {
270274 if ( value . indexOf ( '.' ) < 0 ) {
271275 value = `${ value } .0` ;
272276 }
273277 }
278+
279+ // Language server throws "input is not literal" without quotes
280+ if ( type === `String` ) {
281+ console . log ( { value } ) ;
282+ value = `\"${ value . replace ( / " / g, '\\"' ) } \"` ;
283+ }
284+
274285 return value ;
275286 } ) ;
276287
277- const formatted = await props . languageClient . sendRequest (
278- ExecuteCommandRequest . type ,
279- {
280- command : 'cadence.server.parseEntryPointArguments' ,
281- arguments : [
282- props . editor . getModel ( ) . uri . toString ( ) ,
283- fixed
284- ] ,
285- } ,
286- ) ;
288+ let formatted : any ;
289+ try {
290+ formatted = await props . languageClient . sendRequest (
291+ ExecuteCommandRequest . type ,
292+ {
293+ command : 'cadence.server.parseEntryPointArguments' ,
294+ arguments : [ props . editor . getModel ( ) . uri . toString ( ) , fixed ] ,
295+ } ,
296+ ) ;
297+ } catch ( e ) {
298+ console . log ( e ) ;
299+ }
287300
288301 // Map values to strings that will be passed to backend
289- const args :any = list . map ( ( arg , index ) => {
290- const { type } = arg ;
291- const fixedValue = fixed [ index ]
292-
293- // We need to keep Bool values as boolean and not string
294- const value = type === "Bool" ? fixedValue === "true" : fixed [ index ]
295-
296- // If we have a complex type - return value formatted by language server
297- if ( isComplexType ( type ) ) {
298- return JSON . stringify ( formatted [ index ] )
299- }
300-
301- return JSON . stringify ( { value, type } ) ;
302- } ) ;
302+ const args : any = list . map ( ( _ , index ) => JSON . stringify ( formatted [ index ] ) )
303303
304304 let rawResult , resultType ;
305305 try {
0 commit comments