2

I want to use emmet in a Javascript file that contains JSX code but I don't want IntelliSense to suggest an emmet whenever I use the dot (.) operator.

For example, I don't want the .rap emmet suggestion to show up:

image

I tried these settings:

"emmet.showSuggestionsAsSnippets": true,
"editor.snippetSuggestions": "bottom",

However, I get another problem:

this problem

Replacing "editor.snippetSuggestions" from "bottom" to "inline" also doesn't help.

AnsonH
  • 2,460
  • 2
  • 15
  • 29
Cvai
  • 23
  • 1
  • 6

2 Answers2

4

The way i use emmet is, I have set a hotkey for emmet exapansion as ctrl+e and use that to expand in js/ts files.

And set emmet's settings like that -

"emmet.showExpandedAbbreviation": "inMarkupAndStylesheetFilesOnly",
"emmet.triggerExpansionOnTab": true,

as, this will not show emmet abbreviation(intellisense) in other than css and html files, and thus don't clutter other intellisense in js and ts files.

Thanks.

Sahil Rajput
  • 318
  • 4
  • 17
  • What about jsx and tsx files? There it makes sense to show – User Oct 13 '22 at 14:22
  • I think getting emmet in JSX and TSX files would simply duplicate this problem i.e., most people don't want to have suggestions for emmet. For me, it's muscle memory now and I don't feel need to see the suggestions for emmet. – Sahil Rajput Oct 16 '22 at 16:58
  • I was actually thinking about tag auto-closing, but this might not be what this post is about, not sure. – User Oct 17 '22 at 08:19
  • you dont need to do tag autoclosing I mean simply: div makes it
    . or say MyComp will make ie , I guess thats what you need? I have my vscode settings @ https://github.com/sahilrajput03/config/blob/main/.config/Code/User/settings.json if you wanna see my config for different options.
    – Sahil Rajput Oct 17 '22 at 19:11
2

To disable emmet (that 'dot snippet' in your screenshot is one of the things emmet does) in javascript/react files you could try adding this to your settings.json file:

"emmet.excludeLanguages": [
        "javascriptreact",
        "javascript"
    ]
Guillermo Brachetta
  • 3,857
  • 3
  • 18
  • 36
  • No, on the contrary, I specifically included them. I've written about it in my first sentence. I like use emmet in js/react files for jsx. – Cvai Feb 13 '21 at 14:47
  • 1
    So I don't understand your question. In your screenshot the dot is emmet, the rest is not. I'm not sure to understand what you want to achieve. – Guillermo Brachetta Feb 13 '21 at 14:50
  • 2
    I want to keep emmet and at the same time make it so that its suggestions was below. I tried to do it but how you can see on the second screenshot in the result I got that all my suggestions were deep below. Maybe there is some possible way to separate emmet from other and to lower only them. – Cvai Feb 13 '21 at 15:07