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

更新时间:2021-04-15 13:40:44

Browse

LSP-json

by sublimelsp ST3

Schema validation/completions for your JSON and Sublime files

Details

Installs

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

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.

  • Make sure you have Node.js installed and node is in your $PATH. The language server subprocess is a Node.js app.
  • 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).

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`."
            }
          },
        }
      }
    ]
  }
}