Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.js file imports and schema loading as statefield #63

Merged
merged 2 commits into from
Nov 7, 2023
Merged

Conversation

acao
Copy link
Collaborator

@acao acao commented Aug 19, 2023

this introduces a breaking change!
with this change, you'll be able to provide schema this way:

import { jsonSchema, updateSchema } from 'codemirror-json-schema'
const state = EditorState.create({ 
// no need to pass schema here anymore
extensions: [jsonSchema()] 
})

const view = new EditorView({ state, parent: selector })

updateSchema(view, schema)

I'm going to do one more pass to change the signature of the linter extensions, where they are exported with the needsRefresh logic

@changeset-bot
Copy link

changeset-bot bot commented Aug 19, 2023

🦋 Changeset detected

Latest commit: 4ac83af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
codemirror-json-schema Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Aug 19, 2023

Deploy Preview for codemirror-json-schema ready!

Name Link
🔨 Latest commit 4ac83af
🔍 Latest deploy log https://app.netlify.com/sites/codemirror-json-schema/deploys/654a0fa9a62e3a00083d87f9
😎 Deploy Preview https://deploy-preview-63--codemirror-json-schema.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@imolorhe imolorhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@@ -681,7 +687,7 @@ export class JSONCompletion {
schema: JSONSchema7,
ctx: CompletionContext
): JSONSchema7Definition[] {
const draft = new Draft07(this.schema);
const draft = new Draft07(this.schema!);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm always wary of using this ! in the code

import {
JSONValidation,
handleRefresh,
type JSONValidationOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you have to manually update all the imports to use the .js extension?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is part of adopting the new node module resolution spec!

@acao
Copy link
Collaborator Author

acao commented Oct 21, 2023

@imolorhe this introduces a breaking change for anyone using the "custom" usage approach, so not bad news at all!

@acao acao merged commit a73c517 into main Nov 7, 2023
2 checks passed
@acao acao deleted the js-file-import branch November 7, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants