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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable annotations (useWorker not working) #275

Open
JasonEtco opened this issue Oct 2, 2017 · 10 comments
Open

Disable annotations (useWorker not working) #275

JasonEtco opened this issue Oct 2, 2017 · 10 comments

Comments

@JasonEtco
Copy link

JasonEtco commented Oct 2, 2017

Heyo 馃憢 I'm having trouble disabling the annotations. After searching through some issues, I've tried out the following:

<AceEditor
  value={code}
  mode="javascript"
  theme="github"
  showLineNumbers
  readOnly
  editorProps={{
    $useWorker: false,
  }}
  setOptions={{
    useWorker: false
  }}
/>

As I understand it, setting either setOptions.useWorker or editorProps.$useWorker to false should disable annotations and linting entirely, but it just isn't working. Any ideas?

Thanks!

@SidneyNemzer
Copy link

Try removing $useWorker: false from the editorProps. It looks like setting both of the options actually doesn't disable the linter. You just need useWorker: false in setOptions.

@securingsincity
Copy link
Owner

@JasonEtco does @SidneyNemzer 's tip help?

@JasonEtco
Copy link
Author

JasonEtco commented Oct 4, 2017

@SidneyNemzer @securingsincity I haven't had a chance to test it, I ended up going with a different component for my needs. Sorry!

For what its worth, I had gone through iterations of trying each one individually which didn't do the trick.

@mattblackdev
Copy link

mattblackdev commented Jan 26, 2018

@securingsincity, I can confirm that @SidneyNemzer tip works:

<AceEditor
  mode="javascript"
  theme="monokai"
  onChange={this.handleChange}
  value={this.state.code}
  name="editor"
  setOptions={{ useWorker: false }}
  editorProps={{ $blockScrolling: true }}
/>

successfully disables the worker. Looking forward to the eslint babel-eslint change upstream.

@SidneyNemzer
Copy link

Looking forward to the eslint babel-eslint change upstream

You've peaked my interest @mattblackdev. Has Ace switched to using ESLint? I haven't seen anything about that being completed on the Ace repo.

@zirho
Copy link

zirho commented Apr 13, 2018

+1
The trick didn't work for me. It keeps trying to start worker.
I wonder if I set useWorker false, does it stop trying to create a worker? Or it creates one but not use it.

@leojh
Copy link

leojh commented Jun 16, 2018

{
  ...,
  setOptions: {
    useWorker: false
  }
}

is disabling all annotations for me

@zhangshuai0101
Copy link

I also encountered the problem of disabled annotations not taking effect.
image
Quick operations can still be used to annotate in development

@Abhishekbs
Copy link

Try removing $useWorker: false from the editorProps. It looks like setting both of the options actually doesn't disable the linter. You just need useWorker: false in setOptions.

yeah, this works

@kialam
Copy link

kialam commented Jul 7, 2021

We are also encountering this issue in our codebase. We have the following component:

<AceEditor
    mode={aceModes[mode] || 'text'}
    className={`pf-c-form-control ${className}`}
    theme="github"
    onChange={debounce(onChange, 250)}
    value={value}
    onFocus={onFocus}
    onBlur={onBlur}
    name={`${id}-editor` || 'code-editor'}
    editorProps={{ $blockScrolling: true }}
    fontSize={16}
    width="100%"
    height={height}
    hasErrors={hasErrors}
    setOptions={{
        readOnly,
        highlightActiveLine: !readOnly,
        highlightGutterLine: !readOnly,
        useWorker: false,
        showPrintMargin: false,
    }}
    commands={[
    {
        name: 'escape',
        bindKey: { win: 'Esc', mac: 'Esc' },
        exec: () => {
        wrapper.current.focus();
        },
    },
    {
        name: 'tab escape',
        bindKey: { win: 'Shift-Tab', mac: 'Shift-Tab' },
        exec: () => {
        wrapper.current.focus();
        },
    },
    ]}
    ref={editor}
/>

However when I introspect from Chrome dev tools the useWorker prop is not present:

useWorkerMissingProp

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

9 participants