apache / couchdb-fauxton

Fauxton is the new Web UI for CouchDB
https://github.com/apache/couchdb-fauxton
Apache License 2.0
378 stars 225 forks source link

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

Closed adamlacoste closed 1 year ago

adamlacoste commented 3 years ago

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

pas-trop-de-zele commented 3 years ago

hello @adamlacoste, can I work on this?

adamlacoste commented 3 years ago

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

pas-trop-de-zele commented 2 years ago

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?

adamlacoste commented 2 years ago

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
Antonio-Maranhao commented 1 year ago

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