uiwjs / react-codemirror

CodeMirror 6 component for React. @codemirror https://uiwjs.github.io/react-codemirror/
https://uiwjs.github.io/react-codemirror/
MIT License
1.65k stars 132 forks source link

Add custom lint error marker on react-codemirror #386

Closed venkat-subramani closed 2 years ago

venkat-subramani commented 2 years ago

I want to display lint errors which I receive from external API. Error information I receive from the API is

  1. Line number
  2. Error description

I would like to add a custom marker with tooltip in the codemirror gutter area. I've found this answer on stackoverflow https://stackoverflow.com/a/72219083 but unable to implement on react-codemirror.

jaywcjlove commented 2 years ago

@venkat-subramani This is not a codemirror 6 solution.

https://codemirror.net/docs/ref/#lint

jaywcjlove commented 2 years ago

https://discuss.codemirror.net/t/yaml-linter-for-uiw-react-codemirror-or-codemirror-v6/4976

jaywcjlove commented 2 years ago

Example: Linter: https://codemirror.net/examples/lint/

venkat-subramani commented 2 years ago

@jaywcjlove Thanks for your response. I'm able to use linter on code area now. Is it possible to display error marker on line numbers in gutter area ?

jaywcjlove commented 2 years ago

@venkat-subramani https://codemirror.net/examples/gutter/

venkat-subramani commented 2 years ago

Adding lintGutter() in the extensions list added the error marking for my lints.

AndrewThian commented 2 years ago

@venkat-subramani I'm sorry to reopen this thread but could you help with an example of how you used js-yaml with react-codemirror for the lint source? I'm having trouble according to the link provided