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

Annotations get removed if a newline is added #129

Closed
Poltergeist opened this issue Jul 14, 2016 · 12 comments
Closed

Annotations get removed if a newline is added #129

Poltergeist opened this issue Jul 14, 2016 · 12 comments

Comments

@Poltergeist
Copy link

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.

@leMaik
Copy link
Contributor

leMaik commented 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.

@securingsincity
Copy link
Owner

@Poltergeist did @leMaik 's advice fix the issue

@leMaik
Copy link
Contributor

leMaik commented Sep 23, 2016

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

@Poltergeist
Copy link
Author

Sadly I never got back to test it, I try to test it asap.

Maik Marschner notifications@github.com schrieb am Fr., 23. Sep. 2016 um
14:46 Uhr:

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


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#129 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJhajW15nV7Mz7yagzCCX5iL5w4WfAIks5qs8oagaJpZM4JMXso
.

@NishaUttawani
Copy link

NishaUttawani commented Feb 24, 2017

I am getting the expected annotations but the hover effect is not there.
It displays nothing when I hover over the cross, no "text" .

Can anyone help?

@securingsincity
Copy link
Owner

In latest version 4.2.3 using the example, I am unable to reproduce this bug. I believe it's been resolved.

@mikolajpp
Copy link

mikolajpp commented Apr 10, 2018

Sadly, I am reproducing this again.
I have this code:

  editor.$useWorker = false;

Whenever cursor leaves or enters the line with custom annotation added, the annotation vanishes.

Cursor can move freely and even add newlines without touching the annotated line. Once it hits it, the annotation disappears.

Reproduction

@abrarmahmood
Copy link

Is there any update on this? I am experiencing the same issue as described by @mikolajpp Thanks

@nurpax
Copy link

nurpax commented Jul 3, 2019

I have this problem too. @abrarmahmood, @mikolajpp did you ever figure out why this is happening? The various ways of setting useWorker=false did not work for me.

@daid
Copy link

daid commented Jul 24, 2019

You need to set the $useWorker on the session:

editor.session.$useWorker = false;

@hamoody-omar
Copy link

I am wondering if there is a way around this because setting useWorker = false disables ace syntax checking and that's not what I want. I want to merge my annotations to the ace's ones.

@aplishka
Copy link

aplishka commented Nov 6, 2019

@hamoody-omar The following answer allows you to use custom annotations alongside the Workers annotations: #483 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants