File tree 1 file changed +12
-3
lines changed
src/webview/src/components
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -67,10 +67,19 @@ const rqUriEncode = (rq) => {
67
67
JSON5 . parse ( commandParam ) ;
68
68
const commandParamEncoded = encodeURIComponent ( formatJson5 ( commandParam ) ) ;
69
69
toRet += `${ command } =${ commandParamEncoded } ` ;
70
- } catch {
70
+ } catch ( e ) {
71
71
// if its a simple string then it's ok
72
72
if ( commandParam . includes ( '{' ) || commandParam . includes ( '[' ) || commandParam . includes ( '"' ) ) {
73
- toRet += `&\n<cannot parse: \n'${ command } =${ commandParam } '\n as JSON5>` ;
73
+ // try to parse the location: .... at x:y as (line, col)
74
+ const matches = / a t ( \d + ) : ( \d + ) $ / . exec ( e ) ;
75
+ if ( matches ) {
76
+ const line = matches [ 1 ] ;
77
+ const col = matches [ 2 ] ;
78
+ const failLine = commandParam . split ( / \r ? \n / ) [ line - 1 ] ;
79
+ toRet += `&\n<${ e } :\n${ failLine } \n${ col > 0 ? ( '-' . repeat ( col - 1 ) + '^' ) : '^' } \n parsing JSON5 at \n'${ command } =${ commandParam } '\n>` ;
80
+ } else {
81
+ toRet += `&\n<cannot parse: \n'${ command } =${ commandParam } '\n as JSON5 due to '${ e } '>` ;
82
+ }
74
83
ok = false ;
75
84
} else {
76
85
toRet += `${ command } =${ commandParam } ` ;
@@ -151,7 +160,7 @@ export default function DLTRestQueryManualDialog(props) {
151
160
error . length > 0 && < div >
152
161
< ErrorIcon />
153
162
< TextField error label = "Error:" name = "DLT rest query error" margin = "dense" id = { 'description-field-rest-query-error' }
154
- InputLabelProps = { { shrink : true , } } fullWidth multiline value = { error }
163
+ InputLabelProps = { { shrink : true , } } fullWidth multiline value = { error } InputProps = { { style : { fontFamily : 'monospace' } } }
155
164
> </ TextField >
156
165
</ div >
157
166
}
You can’t perform that action at this time.
0 commit comments