Coder Social home page Coder Social logo

Comments (3)

b0o avatar b0o commented on May 24, 2024 4

Thanks for reporting! This isn't an issue with SchemaStore.nvim, but it is an important behavior that I should describe in the documentation.

This is due to the way jsonls handles its configuration, which is a bit counter-intuitive IMO. It seems that if you pass settings = { json = { ... } }, jsonls treats any unspecified option as false, rather than using the default value that would be used if you didn't pass any settings. The option that is causing your issue is validate.enable. To fix this, you can explicitly enable the validate option:

nvim_lsp.jsonls.setup({
  on_attach = on_attach,
  capabilities = capabilities,
  settings = {
    json = {
      validate = { enable = true },
      schemas = require("schemastore").json.schemas(),
    },
  },
})

from schemastore.nvim.

mcritchlow avatar mcritchlow commented on May 24, 2024 1

Ah, that's so helpful, thank you! I definitely agree that it's counter-intuitive to flip default settings when another setting is changed.. But that definitely addresses the issue on my end. Again, much appreciated :)

from schemastore.nvim.

b0o avatar b0o commented on May 24, 2024

For reference, here is the jsonls code causing this issue: https://github.com/microsoft/vscode/blob/6fef251f8f0e9f74b7adb4ed310e35eabb97afdf/extensions/json-language-features/server/src/jsonServer.ts#L230-L239

validateEnabled is true by default, but if any of the settings are changed, it defaults to false.

If you wanted, you could open an issue there and suggest that the default values should be kept if the settings doesn't include a certain key. They have over 6k open issues, though, so I have my doubts that it would be fixed any time soon.

from schemastore.nvim.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.