feat(settings): add JSON editor indentation option (2 or 4 spaces)#200
feat(settings): add JSON editor indentation option (2 or 4 spaces)#200Pranav-0440 wants to merge 7 commits intoeclipse-editdor:masterfrom
Conversation
- Added new 'JSON Editor' section in Settings - Introduced jsonIndentation (2 | 4) in SettingsData - Connected indentation setting to Monaco editor tabSize - Auto-format JSON using selected indentation - Prevent infinite formatting loop - Apply changes immediately after saving settings Closes eclipse-editdor#185 Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
✅ Deploy Preview for editdor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds a JSON editor indentation configuration option to allow users to choose between 2 or 4 space indentation. The feature includes a new "JSON Editor" settings section with a dropdown selector, integration with Monaco editor's tabSize option, and automatic formatting of JSON content according to the selected indentation.
Changes:
- Added jsonIndentation property (2 | 4) to SettingsData interface
- Created new JSON Editor settings section with indentation selector
- Integrated indentation setting with Monaco editor tabSize configuration
- Implemented automatic JSON formatting with selected indentation on content changes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/components/App/Settings.tsx | Added jsonIndentation property to SettingsData interface, implemented handler and UI for indentation selection |
| src/components/Editor/JsonEditor.tsx | Extracted jsonIndentation from context, applied to Monaco editor options, added formatting logic in onChange handler |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
|
If you need to understand what the code does instead of blindly trust the output of an AI. Here is a sample file to test |
Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
|
Thank @TejInaco @egekorkan you for the sample file and the feedback. I reviewed the implementation carefully and tested the feature using the provided large JSON example.
If you still observe unexpected behavior, please let me know which scenario reproduces it and I will investigate immediately. |
TejInaco
left a comment
There was a problem hiding this comment.
Good work @Pranav-0440. There is a few changes that you need to do. First of all SettingsData should not be in the context, that is data for the local storage. However the case of jsonIndentation is different it should be in the context.
There was a problem hiding this comment.
Good work @Pranav-0440. There is a few changes that you need to do. First of all SettingsData should not be in the context, that is data for the local storage. However the case of jsonIndentation is different it should be in the context. Split the SettingsData from jsonIndetation. SettingsData case is for local storage only.
…ttings local Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
|
@TejInaco Refactored as suggested. Moved |
|
@Pranav-0440 you still have pending reviews. Please marked them as solved after you commit the changes being requested |
|
@TejInaco All changes applied and review threads resolved. Ready for review. |
| validate.report.json = "failed"; | ||
| context.updateValidationMessage(validate); | ||
| setLocalTextState(editorText); | ||
| delay(messageWorkers, editorText ?? "", 500); |
There was a problem hiding this comment.
Revert these changes it is outside of the scope of this issue. if you spotted a bug here you can open an issue.
Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
|
@TejInaco Restored the original error handling logic to keep the PR strictly focused on the JSON indentation feature. |
TejInaco
left a comment
There was a problem hiding this comment.
Good work @Pranav-0440 almost there. Mark the pending comments after you see them.
…ation with context API Signed-off-by: Pranav-0440 <pranavghorpade61@gmail.com>
|
@TejInaco - Applied requested refactors: replaced select with Dropdown and aligned jsonIndentation with the context API. All review comments addressed. |

Closes #185