docs: Validate JSON snippets (settings, keymap, tasks, etc) (#40043)
Closes #ISSUE Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -28,7 +28,7 @@ Zed allows you to override global settings for individual languages. These custo
|
||||
|
||||
Here's an example of language-specific settings:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Python": {
|
||||
"tab_size": 4,
|
||||
@@ -67,7 +67,7 @@ Zed automatically detects file types based on their extensions, but you can cust
|
||||
|
||||
To set up custom file associations, use the [`file_types`](./configuring-zed.md#file-types) setting in your `settings.json`:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"file_types": {
|
||||
"C++": ["c"],
|
||||
"TOML": ["MyLockFile"],
|
||||
@@ -119,7 +119,7 @@ Some languages in Zed offer multiple language server options. You might have mul
|
||||
|
||||
You can specify your preference using the `language_servers` setting:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"PHP": {
|
||||
"language_servers": ["intelephense", "!phpactor", "..."]
|
||||
@@ -145,7 +145,7 @@ Not all languages in Zed support toolchain discovery and selection, but for thos
|
||||
|
||||
Many language servers accept custom configuration options. You can set these in the `lsp` section of your `settings.json`:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
@@ -170,7 +170,7 @@ Suppose you want to configure the following settings for TypeScript:
|
||||
|
||||
Here's how you would structure these settings in Zed's `settings.json`:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"typescript-language-server": {
|
||||
"initialization_options": {
|
||||
@@ -198,7 +198,7 @@ Sent once during language server startup, requires server's restart to reapply c
|
||||
|
||||
For example, rust-analyzer and clangd rely on this way of configuring only.
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
@@ -213,7 +213,7 @@ For example, rust-analyzer and clangd rely on this way of configuring only.
|
||||
May be queried by the server multiple times.
|
||||
Most of the servers would rely on this way of configuring only.
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"tailwindcss-language-server": {
|
||||
"settings": {
|
||||
@@ -229,7 +229,7 @@ Apart of the LSP-related server configuration options, certain servers in Zed al
|
||||
|
||||
Language servers are automatically downloaded or launched if found in your path, if you wish to specify an explicit alternate binary you can specify that in settings:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"binary": {
|
||||
@@ -249,7 +249,7 @@ Language servers are automatically downloaded or launched if found in your path,
|
||||
|
||||
You can toggle language server support globally or per-language:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Markdown": {
|
||||
"enable_language_server": false
|
||||
@@ -267,7 +267,7 @@ Zed provides support for code formatting and linting to maintain consistent code
|
||||
|
||||
Zed supports both built-in and external formatters. See [`formatter`](./configuring-zed.md#formatter) docs for more. You can configure formatters globally or per-language in your `settings.json`:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"formatter": {
|
||||
@@ -289,7 +289,7 @@ This example uses Prettier for JavaScript and the language server's formatter fo
|
||||
|
||||
To disable formatting for a specific language:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"Markdown": {
|
||||
"format_on_save": "off"
|
||||
@@ -301,7 +301,7 @@ To disable formatting for a specific language:
|
||||
|
||||
Linting in Zed is typically handled by language servers. Many language servers allow you to configure linting rules:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"lsp": {
|
||||
"eslint": {
|
||||
"settings": {
|
||||
@@ -317,7 +317,7 @@ This configuration sets up ESLint to organize imports on save for JavaScript fil
|
||||
|
||||
To run linter fixes automatically on save:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"formatter": {
|
||||
@@ -331,7 +331,7 @@ To run linter fixes automatically on save:
|
||||
|
||||
Zed allows you to run both formatting and linting on save. Here's an example that uses Prettier for formatting and ESLint for linting JavaScript files:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"languages": {
|
||||
"JavaScript": {
|
||||
"formatter": [
|
||||
@@ -368,7 +368,7 @@ Zed uses Tree-sitter grammars for syntax highlighting. Override the default high
|
||||
|
||||
This example makes comments italic and changes the color of strings:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"experimental.theme_overrides": {
|
||||
"syntax": {
|
||||
"comment": {
|
||||
@@ -388,7 +388,7 @@ Change your theme:
|
||||
1. Use the theme selector ({#kb theme_selector::Toggle})
|
||||
2. Or set it in your `settings.json`:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"theme": {
|
||||
"mode": "dark",
|
||||
"dark": "One Dark",
|
||||
@@ -410,7 +410,7 @@ To create your own theme extension, refer to the [Developing Theme Extensions](.
|
||||
|
||||
Inlay hints provide additional information inline in your code, such as parameter names or inferred types. Configure inlay hints in your `settings.json`:
|
||||
|
||||
```json
|
||||
```json [settings]
|
||||
"inlay_hints": {
|
||||
"enabled": true,
|
||||
"show_type_hints": true,
|
||||
|
||||
Reference in New Issue
Block a user