Jsonls shows no errors, every other language works

Hello everyone,

I recently migrated from vim to neovim, and created my config by watching a series of youtube videos titled “Neovim IDE from Scratch”. Everything works like a charm, except for ONE thing: I added jsonls as a client / handler for JSON files with LSP, and configured it with the schemas for tsconfig.json and package.json, but I see no errors when I modify a file so that it is invalid JSON.

I must say I also added clients for other language types (lua, zig, C, Perl, SQL, typescript), and they all show the error indicator at the left of the line numbers, and the error pops up when I hit the keymap I configured for that (gl, in case it matters).

I see nothing special in my config that might alter the behavior only for JSON files. These are the settings I am using for jsonls:

{
    json = {
      schemas = {
        {
          fileMatch = { 'package.json' },
          url = 'https://json.schemastore.org/package.json',
        },
        {
          fileMatch = { 'tsconfig.json', 'tsconfig.*.json' },
          url = 'http://json.schemastore.org/tsconfig',
        },
      },
    },
}

Also, when I open a JSON file and run :LspInfo, I do see the jsonls client is attached to the file.

I would appreciate any hints. Thanks!

Replying to myself: I have tried opening tsconfig.json with other “quick config” neovim modules (such as LunarVim) and they behave the same: they can only reformat / highlight the file, but there are no error messages regarding missing commas / quotes / etc. I guess this is how the LSP server for JSON works?

Cheers.

I fixed it by making my settings = nil

 ["jsonls"] = function()
    lspconfig.jsonls.setup({
      capabilities = capabilities,
      handlers = handlers,
      on_attach = on_attach,
      settings = nil --require("config.lsp.servers.jsonls").settings,
    })
  end,

For some reason when schemas are defined for me, it doesnt check json.