Giter Site home page Giter Site logo

Comments (3)

mindofmatthew avatar mindofmatthew commented on May 23, 2024 1

My specific use-case is a configuration object where certain fields are file paths on the users' system. In this case, autocompletion of file paths (plus theoretical linting of missing files, etc) would be awesome.

I'm not super well-versed in JSON Schema, but it seems like the way to represent these semantics would be through a custom format field, which can be used for implementation-specific validation or annotation of fields. json-schema-library allows custom validators for this purpose, though I'm not sure if that's how you'd want to approach it.

Perhaps the better approach would be a separate autocompletion source extension that combines with/overrides the standard JSON Schema autocompletion using the usual CM6 mechanisms for combining extensions. For that, is there already a way to query relevant JSON Schema information about a given code range or syntax node?

from codemirror-json-schema.

acao avatar acao commented on May 23, 2024

I'm trying to understand your case better, is there a reason this can't be acheived with json schema? is there a remotely defined json schema definition that's not loading?

from codemirror-json-schema.

acao avatar acao commented on May 23, 2024

format could be used, but for example, generating a jsonschema enum on the fly might work better. for your case it could just resolve the results of readdir() on complete directory paths as you type, though we would need to provide some API callback to let you hook into our autocomplete without needing to write your own, then you could be provided with a functional interface to append to the autocomplete options, because you would need the input value to generate your results, rather than providing it as source to the mode invocation config. #63 improves the dynamic schema state changes so you will just be able to call updateSchema() every time you change the incoming schema value, and codemirror's state field will update without reloading the editor

similarly, for example, with monaco-graphql, we feed dynamically generated json schema to monaco-json based on user input

If you choose the additional autocomplete idea, which is also sound, I wonder if we can't provide additional API hooks to make it easier to author your own completion logic for certain cases 🤔 there has to be a more codemirror 6 appropriate way to solve this problem. I will open a ticket on the cm6 forum to ask the authors what they think is ideal - I'm sure other language modes have come across this problem.

from codemirror-json-schema.

Related Issues (20)

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.