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

controlling linting from a button click #311

Open
hjangir154 opened this issue Nov 17, 2023 · 0 comments
Open

controlling linting from a button click #311

hjangir154 opened this issue Nov 17, 2023 · 0 comments

Comments

@hjangir154
Copy link

I have case where I need to update the linting error messages from a button click outside the codeMirror component. Although values are updating it wont show up on the editor until i manually update the text inside the editor by typing.

I tried following

  1. refresh editor using instance
  2. updating value prop: value get's updated but linting wont show up
  3. calling forceRefresh() method on component
{
    "mode": "text/x-hive",
    "indentWithTabs": false,
    "lineWrapping": true,
    "lineNumbers": true,
    "gutters": [
        "CodeMirror-lint-markers"
    ],
    "extraKeys": {
        "Ctrl-Space": "autocomplete",
        "Ctrl-/": "toggleComment"
    },
    "indentUnit": 2,
    "theme": "default",
    "matchBrackets": true,
    "autoCloseBrackets": true,
    "highlightSelectionMatches": true,
    "cursorBlinkRate": 530,
    "lint": {
        "async": true,
        "delay": 1000,
         "getAnnotations" : (text, onComplete, _, editor) => {…}
    },
    "tabSize": 2
}

this is the option object i am passing in,

(text: string, onComplete, _, editor) => {
    if ((text || '').length === 0) {
        return;
    }
    function complete(options: []) {
        console.log("OPTIONS inside", options, suggetions)
        onComplete(options.concat(suggetions));
        editor?.refresh();
    }
    console.log("GetAnnotationCalled", suggetions)
    getSqlLintAnnotationsDebounced(text, language, complete);
}

image

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

No branches or pull requests

1 participant