josdejong/jsoneditor

Make auto-completion by schame to work with non-valid JSONs

Open

#1443 aperta il 14 giu 2022

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)JavaScript (2034 fork)batch import
featurehelp wanted

Metriche repository

Star
 (10.781 star)
Metriche merge PR
 (Merge medio 15h 36m) (3 PR mergiate in 30 g)

Descrizione

This issue is a continue of #968 which was implemented on change #1435

The current implementation is limited to work only with valid JSONs, as described in the change request comment.

This is a hard limitation, as usually we want to have the auto-complete suggestions while editing the JSON, and it is likely to be a non-valid while typing its content.

There has being some suggestions how to resolve it:

  1. straight forward approach:  try to figure out the missing part and fix it on-the-fly, like removing/fixing the current line and try again - this might not cover every use case but might be sufficient for most of the common use cases
  2. use external packages like jsonrepair or partial-json-parser to repair/parse the non-valid JSON - this might be challenging as it might not be aligned wit the current cursor location on the document, so the result can be wrong suggestions
  3. find a way to Integrate with the ACE editor JSON parser, and perhaps use the internal AST to understand the current path of the cursor location

Guida contributor