zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.1k stars 2.71k forks source link

Impossible to save YML files without Zed messing up my double quotes #17649

Open armchairdj opened 1 week ago

armchairdj commented 1 week ago

Check for existing issues

Describe the bug / provide steps to reproduce it

My project uses double quoted strings in YML files. Example:

en:
  errors:
    messages:
      contains_url: "cannot contain a url"

But Zed is currently too stupid to understand that preference making it impossible for me to get work done in Zed in Rails without constantly swtiching to another editor every time I open a yml file.

Zed configured like this:

  "lsp": {
    "yaml-language-server": {
      "initialization_options": {
        "yaml": {
          "format": {
            "singleQuote": false
          }
        }
      }
    }
  }

But every time I save a YML file, Zed tries to convert every double quoted string to a single quoted string. Apostrophes within those double quoted strings hopelessly confused Zed, so it's not every single line that gets edited.

Seems like my only current recourse is to completely disable any kind of lint-on-save behavior globally.

Please help.

Environment

Zed: v0.149.6 (Zed) OS: macOS 13.3.1 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


JosephTLyons commented 1 week ago

Hey @armchairdj, would you be able to copy and paste in your entire settings.json file's contents? I'm not able to reproduce this behavior on my end as is. Thanks.

armchairdj commented 1 week ago

Sure!

// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run `zed: open default settings` from the
// command palette
{
  "base_keymap": "TextMate",
  "buffer_font_size": 18,
  "preferred_line_length": 120,
  "show_whitespaces": "all",
  "show_wrap_guides": true,
  "tab_size": 2,
  "ui_font_size": 20,
  "use_autoclose": false,
  "wrap_guides": [80, 120],
  "file_types": {
    "SCSS": ["scss", "sass"]
  },
  "git": {
    "inline_blame": {
      "enabled": false
    }
  },
  "languages": {
    "ruby": {}
  },
  "project_panel": {
    "button": true,
    "default_width": 240,
    "dock": "left",
    "file_icons": true,
    "folder_icons": true,
    "git_status": true,
    "indent_size": 20,
    "auto_reveal_entries": false,
    "auto_fold_dirs": true,
    "scrollbar": {
      "show": "always"
    }
  },
  "theme": {
    "mode": "system",
    "light": "One Light",
    "dark": "Atelier Dune Dark"
  },
  "lsp": {
    "yaml-language-server": {
      "initialization_options": {
        "yaml": {
          "format": {
            "singleQuote": false
          }
        }
      }
    }
  }
}