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.27k stars 2.73k forks source link

Show whitespace/invisibles #5592

Closed Daeraxa closed 1 year ago

Daeraxa commented 2 years ago

It would be nice if Zed could display whitespace characters/invisibles. I find this really useful when editing documentation and reviewing certain types of log files so is often left on.

Atom has settings for showing whitespace characters/invisibles (Editor > Invisibles) where visible types of whitespace can be identified. This is also present in other editors (Notepad++, VSCode).

I like the amount of flexibility provided by Atom to change the character displayed for each whitespace "type" but personally I've never changed it from the default. If implemented it would be nice to toggle from the command palette rather than setting in the options, again like in Atom Window: Toggle invisibles

image image

cktang88 commented 1 year ago

Yes especially in Python or other whitespace languages, being able to see tabs vs spaces is very important

JosephTLyons commented 1 year ago

We are landing some support for this in v0.86.0. I'm going to close this for now. If there are additional requests for more additions after, feel free to open up a new issue.

potomak commented 1 year ago

I tried to add this setting on a language override, but it doesn't work.

My settings.json:

{
  "telemetry": {
    "metrics": false
  },
  "buffer_font_size": 15,
  "language_overrides": {
    "Markdown": {
      "tab_size": 2,
      "show_whitespaces": "all"
    }
  }
}
SomeoneToIgnore commented 1 year ago

It's a global, editor setting that's supposed to be in the root of the settings, something like this:

{
    "features": {
        "copilot": true
    },
    "theme": "Ayu Mirage",
    "format_on_save": "on",
    "show_whitespaces": "all",
    "soft_wrap": "editor_width",
    "tab_size": 4
}
potomak commented 1 year ago

Yes, I tried it as a global setting and it works as expected there. This was just a feedback in case this is also supposed to work as a language setting. Example: I care about white spaces in Python and Markdown, but not elsewhere.

I would also like to report that it would be useful to surface configuration errors, like settings not supported by the schema.

pshergie commented 5 months ago

the visible whitespaces across all included light themes are way too prominent, could you make it paler or give us an option to edit the color?

image
joseftw commented 4 months ago

It's possible to change the color like this:

"experimental.theme_overrides": {
    "editor.invisible": "#777777"
  },
pshergie commented 4 months ago

It's possible to change the color like this:

"experimental.theme_overrides": {
    "editor.invisible": "#777777"
  },

it works! didn't know about the setting

bajtos commented 4 months ago

It's possible to change the color like this:

"experimental.theme_overrides": {
    "editor.invisible": "#777777"
  },

How does this setting interact with dark/light mode and custom theme colours? Instead of configuring the exact colour, have you considered allowing the user to configure the opacity (alpha channel) that will be applied to the theme-specific colour?

pshergie commented 4 months ago

It's possible to change the color like this:

"experimental.theme_overrides": {
    "editor.invisible": "#777777"
  },

the problem with the setting is that it works for light themes but looks bad for dark ones