question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Annotations get removed if a newline is added

See original GitHub issue

If one adds an annotations as a prop to the react ace component. They only get shown until I add a newline to the value. To show that problem I changed the example. The only thing I changed is adding annotations to the example/index.js in line 29. annotations={[{ row: 5, column: 2, type: 'error', text: 'Some error.'}]}. I got it to work if I put the render on line 24 into a function and call that function with the newValue Full change starting on line 19

function onChange(newValue) {
  console.log('change', newValue);
  renderFirst(newValue);
}

function renderFirst(value = '') {
  // Render first editor
  render(
    <AceEditor
      mode="java"
      theme="github"
      name="blah1"
      value={value}
      annotations={[{ row: 5, column: 2, type: 'error', text: 'Some error.'}]}
      height="6em"
      onChange={onChange}
    />,
    document.getElementById('example')
  );
}

renderFirst();

react-ace-annotations mov

I hope the description is clear, and I hope this is not me using the component wrong. Thanks in advance.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
leMaikcommented, Aug 12, 2016

I know I’m late to the party, but this might help: Try to set editorProps={{$useWorker: false}} on the editor component. This disables Ace’s internal annotations and prevents it from overriding custom annotations after newlines.

1reaction
leMaikcommented, Sep 23, 2016

Well, at least it fixed the very same issue for me. 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Platform specific newline character in annotation
Save this question. Show activity on this post. I'd like to use platform specific newline character in String provided in annotation element.
Read more >
Python | Removing newline character from string
This task can also be executed using regex functions which can also perform the global replace of all the newline characters with an...
Read more >
how to avoid the newline in figure annotation, please help. I ...
how to avoid the newline in figure annotation,... Learn more about annotation, newline, plot. ... Using cell string, each cell will be in...
Read more >
Segmentation and newlines in ner.manual - Prodigy Support
I wish to display an entire length of contract while annotating using ner.manual in one go. Since Prodigy takes input from one file...
Read more >
How to remove newlines from a string in Python 3?
If you have a string that contains multiple line breaks, you can use the replace method and get multiple newlines removed / replaced....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found