ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

LSP-json

by sublimelsp ST3

Schema validation/completions for your JSON and Sublime files

Details

Installs

  • Total 14K
  • Win 5K
  • Mac 5K
  • Linux 4K
Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19
Windows 1 10 15 8 16 13 3 4 4 7 10 11 9 7 7 13 12 9 7 7 8 10 4 6 10 13 9 3 5 7 12 5 5 4 6 10 10 6 8 7 11 4 3 10 7 15
Mac 2 5 10 5 14 8 2 6 4 8 8 10 8 2 7 6 9 9 4 2 3 2 6 7 9 6 7 3 5 10 6 7 9 5 4 5 9 6 9 4 5 2 5 6 12 16
Linux 0 3 6 8 6 4 3 3 5 4 2 9 4 4 5 7 7 3 8 8 3 3 11 6 10 6 4 7 9 5 4 10 5 1 3 5 9 10 2 8 12 3 6 10 7 5

Readme

Source
raw.​githubusercontent.​com

LSP-json

JSON support for Sublime's LSP plugin.

Uses VSCode JSON Language Server to provide validation, formatting and other features for JSON files. See linked repository for more information.

Installation

  • Install LSP and LSP-json from Package Control.
  • Restart Sublime.

Configuration

Open configuration file using command palette with Preferences: LSP-json Settings command or opening it from the Sublime menu (Preferences > Package Settings > LSP > Servers > LSP-json).

For users of PackageDev

The PackageDev package implements features that provide completions and tooltips when editing the Sublime settings files, which overlaps and conflicts with functionality provided by this package. To take advantage of the strict schemas that this package provides, disable corresponding functionality in PackageDev by opening Preferences: PackageDev Settings from the Command Palette and set the following settings on the right side:

{
  "settings.auto_complete": false,
  "settings.tooltip": false
}

Color Provider

The JSON-Language-Server implements a color provider that adds color decorators next to values representing colors in JSON files. If you are using a color plugin like ColorHelper or Color Highlight you may wish to disable this feature. To disable it open the LSP-json Settings as described above and add the following settings on the right side:

{
  "disabled_capabilities": {
    "colorProvider": true
  }
}

Custom schemas

To load manually created schemas, add those to userSchemas configuration in the settings file. See more information in the comments there.

Schemas contributed by Packages

Sublime Text packages can provide schemas for its own settings, or contribute to global ST settings or other configuration files (for example *.sublime-project files).

This is accomplished by including a sublime-package.json file in the package (location doesn't matter) and defining schemas within it. Any changes made to the schemas are automatically applied to matching files so there is no need to restart the server or ST.

Here is a an example of three different schemas defined in one sublime-package.json file:

{
  "contributions": {
    "settings": [
      {
        // Schema for MyPackage configuration.
        "file_patterns": ["/MyPackage.sublime-settings"],
        "schema": {
          "properties": {
            "my_cool_setting": {
              "type": "string",
              "default": "yes",
              "enum": ["yes", "no"],
              "markdownDescription": "Decides whether something is `on` or `off`."
            }
          },
          "additionalProperties": false,
        }
      },
      {
        // Schema to extend global ST Preferences.
        "file_patterns": ["/Preferences.sublime-settings"],
        "schema": {
          "properties": {
            "my_cool_setting": {
              // Reuses definition from the pattern-less schema defined below.
              "$ref": "sublime://settings/foo/base#/definitions/ReuseMe"
            }
          },
        }
      },
      {
        // Pattern-less schema (note that "file_patterns" is missing).
        // Can be added for the purpose of referencing it (or its definitions) from another schema.
        // Pattern-less schema must define an "$id" to be able to refer to it from other schemas.
        // It's recommended to assign URIs like "sublime://settings/foo/base" for "$id".
        "schema": {
          "$id": "sublime://settings/foo/base"
          "definitions": {
            "ReuseMe": {
              "type": "string",
              "default": "no",
              "enum": ["yes", "no"],
              "markdownDescription": "Decides whether something is `on` or `off`."
            }
          },
        }
      }
    ]
  }
}