vscode-react-javascript-snippets icon indicating copy to clipboard operation
vscode-react-javascript-snippets copied to clipboard

reactSnippets.settings.importReactOnTop not working

Open DavidArmendariz opened this issue 3 years ago • 14 comments
trafficstars

This configuration is not working. When I set this in my settings.json:

reactSnippets.settings.importReactOnTop

And then try to use any snippet, it is still importing React on the top.

DavidArmendariz avatar Feb 27 '22 01:02 DavidArmendariz

@DavidArmendariz please provide full settings.json related to reactSnippets and some repro as on my end works fine.

ice-chillios avatar Feb 27 '22 11:02 ice-chillios

@dsznajder I don't have any other configurations related to reactSnippets. I only have this in my settings.json:

"reactSnippets.settings.importReactOnTop": false,

The repro would be to type some command like rafce. It would give me something like this:

import React from 'react'

const index = () => {
  return (
    <div>index</div>
  )
}

export default index

DavidArmendariz avatar Feb 28 '22 16:02 DavidArmendariz

Did you reload vscode after changing this settings as extension said?

ice-chillios avatar Feb 28 '22 16:02 ice-chillios

@dsznajder Yes!

DavidArmendariz avatar Feb 28 '22 18:02 DavidArmendariz

i'm having the same issue with reactSnippets.settings.importReactOnTop setting. Even setting it to false it still keeps showing up with the rfce snippet.

saulloalmeida avatar Mar 22 '22 21:03 saulloalmeida

I had this same issue recently start happening. I resolved it by toggling the setting on & off again, then invoking Developer: Reload Window.

opes avatar Apr 06 '22 18:04 opes

same issue, my setting snd settings.json has - "reactSnippets.settings.importReactOnTop": false, but still rafce is importing the react at top. please fix it. have restarted and reloaded the VS CODE

notkiran avatar Apr 11 '22 18:04 notkiran

I'm also having the same issue with ImportReactOnTop setting not working

settings.json is set to this "reactSnippets.settings.importReactOnTop": false,

When i use the rafce snippet it generates

import React from 'react'

const App = () => {
  return (
    <div>App</div>
  )
}

export default App

please fix thanks :)

dougbeckwith avatar Apr 15 '22 16:04 dougbeckwith

I am also experiencing this issue. I have done the following steps and it still places the import statement at the top:

  1. Set "reactSnippets.settings.importReactOnTop": true
  2. Reloaded window
  3. Ran rfc confirm import statement is present
  4. Set "reactSnippets.settings.importReactOnTop": false
  5. Reloaded window
  6. Ran rfc confirm import statement is still present (should not be present)

bradenmitchell avatar Apr 29 '22 02:04 bradenmitchell

I am also having this issue. I am running the latest version (4.4.3) with the setting on false and it still imports React when i use the snippets

Jolsty avatar Nov 14 '22 16:11 Jolsty

have the same issue, any updates on this?

csfx-py avatar Nov 20 '22 16:11 csfx-py

disabling and enabling it fixed for me. but this solution is not permanent

push-on avatar Dec 28 '22 16:12 push-on

I found that disabling this experimental setting made it work properly again!

image

Jolsty avatar Dec 30 '22 15:12 Jolsty

As of today, this is still an issue, it feels like the reactSnippets.settings.importReactOnTop setting can disable it, but not re enable it after. I have tested everything:

  • enable the Prettier experimental setting (disabled by default after install) > reload > disable
  • disable the extension > reload> re enable it

The only thing that worked to add back the React import on top after disabling it, is the following:

  • uninstall the extension > restart (not a simple reload!) > comment out the "reactSnippets.settings.importReactOnTop": false setting in User Settings (JSON) or set it to true > re install it.

hymced avatar Nov 28 '23 21:11 hymced