couchdb-fauxton icon indicating copy to clipboard operation
couchdb-fauxton copied to clipboard

JSON editor uses 3-space indent but draws guides at 2

Open adamlacoste opened this issue 3 years ago • 4 comments

The JSON editors used in the Mango query and manage indexes screens will automatically reformat your input on submit. When it does this, it appears to use a 3-space indent, which is odd on its own, but it also contradicts the indent guides drawn in the editor every 2 spaces.

Expected Behavior

Upon submitting JSON input, the reformatted code's indentation and visual indent guides should match. Since a 3-space indent is nonstandard and the visual guides suggest that 2 spaces was intended, it seems like a 2-space indent should be used.

Current Behavior

Upon submitting JSON input, the reformatted code's indentation and visual indent guides do not match. The code uses a 3-space indent even though the visual guides are drawn every two columns.

Context

I realize this is a trivial thing and will probably not be a high priority fix. I suspect it would be simple to correct for someone who knows their way around the code, but my search through the code did not turn up any clear place where this indent size was being set. If anybody more familiar with the codebase could point me in the right direction, I would be happy to submit a pull request to fix this.

Environment

  • Version used: CouchDB 3.1.1
  • Browser Name and version: Safari 14.0.3
  • Operating System and version (desktop or mobile): MacOS 11.2.3

adamlacoste avatar Mar 31 '21 20:03 adamlacoste

hello @adamlacoste, can I work on this?

pas-trop-de-zele avatar Sep 20 '21 22:09 pas-trop-de-zele

Be my guest, @pas-trop-de-zele !

adamlacoste avatar Sep 22 '21 02:09 adamlacoste

Hi @adamlacoste, I was trying to replicate your issue with the 3 space indent but it seems like mine shows 2 spaces, any change you could produce a screenshot?

pas-trop-de-zele avatar Oct 18 '21 05:10 pas-trop-de-zele

No problem @pas-trop-de-zele, I have attached two images. The first was taken in fauxton's mango query editor in Couch v3.2.0 on MacOS (Big Sur) Safari (15.0). The second is that same JSON copied into Sublime Text, which better illustrates the whitespace in use.

fauxton_3space_mango fauxton_3space_sublime

adamlacoste avatar Oct 22 '21 22:10 adamlacoste

Fixed in https://github.com/apache/couchdb-fauxton/pull/1388

Antonio-Maranhao avatar Feb 09 '23 19:02 Antonio-Maranhao