From ed675a5eea0d8ff9ebdfa7fe370a457b888dafec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Tue, 6 Jan 2026 23:30:45 +0100 Subject: [PATCH] DEV: add Zed editor configuration (#36958) Discourse already ships with VS Code settings samples, but more developers are starting to use Zed as their daily driver. This adds a shared config that matches the project's coding standards. The config sets up: - Proper tab sizes and formatting rules per language - ESLint + Prettier integration for JS/TS/Glimmer files - ruby-lsp with rubocop for Ruby - stylelint for SCSS - File type mappings for .gjs/.gts (Glimmer components) This way, Zed users get format-on-save and linting that aligns with what CI expects, reducing friction and style-related review comments. --- .gitignore | 4 ++ .zed/settings.json.sample | 105 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .zed/settings.json.sample diff --git a/.gitignore b/.gitignore index c744a3682fa..1f914362ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,10 @@ !/.vscode/extensions.json !/.vscode/*.sample +# Same for Zed config +/.zed/* +!/.zed/*.sample + # Front-end dist node_modules diff --git a/.zed/settings.json.sample b/.zed/settings.json.sample new file mode 100644 index 00000000000..4d4274017bf --- /dev/null +++ b/.zed/settings.json.sample @@ -0,0 +1,105 @@ +{ + "tab_size": 2, + "hard_tabs": false, + "ensure_final_newline_on_save": true, + "remove_trailing_whitespace_on_save": true, + "formatter": "auto", + "format_on_save": "on", + + "languages": { + "JavaScript": { + "tab_size": 2, + "formatter": "prettier", + "language_servers": ["eslint", "typescript-language-server"], + "code_actions_on_format": { + "source.fixAll.eslint": true + } + }, + "TypeScript": { + "tab_size": 2, + "formatter": "prettier", + "language_servers": ["eslint", "typescript-language-server"], + "code_actions_on_format": { + "source.fixAll.eslint": true + } + }, + "Ruby": { + "tab_size": 2, + "language_servers": ["ruby-lsp", "!solargraph", "!sorbet", "!steep"] + }, + "SCSS": { + "tab_size": 2, + "formatter": "prettier", + "language_servers": ["stylelint"] + }, + "CSS": { + "tab_size": 2, + "formatter": "prettier" + }, + "Handlebars": { + "tab_size": 2, + "formatter": "prettier", + "ensure_final_newline_on_save": false + }, + "Markdown": { + "remove_trailing_whitespace_on_save": false + }, + "YAML": { + "tab_size": 2 + }, + "JSON": { + "tab_size": 2 + }, + "Glimmer (JavaScript)": { + "tab_size": 2, + "language_servers": ["eslint", "typescript-language-server"], + "formatter": { + "external": { + "command": "pnpm", + "arguments": ["prettier", "--stdin-filepath", "{buffer_path}"] + } + }, + "code_actions_on_format": { + "source.fixAll.eslint": true + } + }, + "Glimmer (TypeScript)": { + "tab_size": 2, + "language_servers": ["eslint", "typescript-language-server"], + "formatter": { + "external": { + "command": "pnpm", + "arguments": ["prettier", "--stdin-filepath", "{buffer_path}"] + } + }, + "code_actions_on_format": { + "source.fixAll.eslint": true + } + } + }, + + "lsp": { + "eslint": { + "settings": { + "workingDirectory": { "mode": "auto" }, + "validate": ["javascript", "typescript", "glimmer-js", "glimmer-ts"] + } + }, + "ruby-lsp": { + "initialization_options": { + "formatter": "syntax_tree", + "linters": ["rubocop"] + } + }, + "stylelint": { + "settings": { + "validate": ["css", "scss"] + } + } + }, + + "file_types": { + "Glimmer (JavaScript)": ["gjs"], + "Glimmer (TypeScript)": ["gts"] + } +}