micro icon indicating copy to clipboard operation
micro copied to clipboard

Micro reindents settings.json files with spaces on open

Open pwhelan opened this issue 1 year ago • 1 comments

Description of the problem or steps to reproduce

When opening JSON files, even with all possible ftoptions settings set to tabstospaces:false micro keeps reindenting then overwriting the settings file with spaces instead upon opening.

This does not happen with any other files, just settings.json, as far as I can tell.

This is my settings.json file:

{
    "*.json": {
        "tabstospaces": false
    },
    "colorscheme": "simple",
    "ft:json": {
        "tabstospaces": false
    },
    "ftoptions": false,
    "tabsize": 8
}

Specifications

Version: 2.0.13 Commit hash: 68d88b57 OS: macOS Terminal: iTerm2 3.5.0 Compiled on June 06, 2024

pwhelan avatar Jun 06 '24 15:06 pwhelan

There was a bug #2647 causing needless overwriting of settings.json every time when micro starts. It was fixed in #3009 but this fix is not present in 2.0.13.

After the fix, micro writes settings.json only when the user sets an option via the set command in micro. In that case, micro still enforces a "canonical" JSON formatting, in particular replaces tabs with spaces. So if you don't want micro to mess with your settings.json, just don't use the set command.

dmaluka avatar Jun 06 '24 18:06 dmaluka