Comments (3)
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.
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.
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)
- simple schema service - pass a single schema service instance to the classes for each lang feature
- basic initial docs
- typedoc markdown
- all codemirror deps should be peer dependencies
- typedoc on release PR only?
- completion insertText for known types
- adopt `json-schema-library` improvements
- Cannot import codemirror-json-schema HOT 7
- Error message: can't find module HOT 32
- Expected type not working HOT 3
- support complex base types
- "required" property not checked? HOT 8
- Console error (json format error) HOT 5
- Module "codemirror-json-schema" has no exported member "handleRefresh"
- YAML support HOT 4
- Add ES modules (ESM) support? HOT 3
- jsonschema rules for array type does not get all applied during validation
- display possible types on hover for each oneOf type
- Missing License HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codemirror-json-schema.