codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 377 forks source link

setDiagnostics doesn't working. #1401

Closed zaohuayudie closed 4 months ago

zaohuayudie commented 4 months ago

use codemirror6 question

I upgrade @codemirror/view latest version get a bug.

"@codemirror/view": "^6.28.0" "@codemirror/lint": "^6.8.1"

view.dispatch(setDiagnostics(view.state,  [{
    from: 0,
    to: 4,
    message: 'error message',
    severity: 'error',
  },
]));

It's doesn't working.

Browser and platform

No response

Reproduction link

No response

marijnh commented 4 months ago

When I try your code, I see the diagnostic underline in the editor.

zaohuayudie commented 4 months ago

When I try your code, I see the diagnostic underline in the editor.

thanks a lot.

I found useState problem, I use memo(component, ()=> true), solve this problem.