Skip to content

jsonls

https://github.com/hrsh7th/vscode-langservers-extracted

vscode-json-language-server, a language server for JSON and JSON schema

vscode-json-language-server can be installed via npm:

npm i -g vscode-langservers-extracted

vscode-json-language-server only provides range formatting. You can map a command that applies range formatting to the entire document:

require'lspconfig'.jsonls.setup {
    commands = {
      Format = {
        function()
          vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})
        end
      }
    }
}

Setup

require'lspconfig'.jsonls.setup{}

Default values

cmd = { "vscode-json-language-server", "--stdio" }
filetypes = { "json" }
init_options = {
  provideFormatter = true
}
root_dir = function(startpath)
    return M.search_ancestors(startpath, matcher)
  end

Available settings

json.colorDecorators.enable

  • Type: boolean
  • Default: true

\%json.colorDecorators.enable.desc\%

json.format.enable

  • Type: boolean
  • Default: true

\%json.format.enable.desc\%

json.maxItemsComputed

  • Type: number
  • Default: 5000

\%json.maxItemsComputed.desc\%

json.schemaDownload.enable

  • Type: boolean
  • Default: true

\%json.enableSchemaDownload.desc\%

json.schemas

  • Type: array
  • Array items:

\%json.schemas.desc\%

json.trace.server

  • Type: enum { "off", "messages", "verbose" }
  • Default: "off"

\%json.tracing.desc\%

Back to top