tailwindlabs / tailwindcss-intellisense

Intelligent Tailwind CSS tooling for Visual Studio Code
2.82k stars 194 forks source link

Intellisense sugestions don't show up if you don't press "space" #931

Closed EntrenaEnCasa closed 6 months ago

EntrenaEnCasa commented 6 months ago

What version of VS Code are you using?

v1.87.2

What version of Tailwind CSS IntelliSense are you using?

v0.10.5

What version of Tailwind CSS are you using?

v3.4.1

What package manager are you using?

pnpm

What operating system are you using?

Windows

Tailwind config

export default {
  theme: {
    extend: {
      colors: {
        primary: {
          '50': '#f0f8fe',
          '100': '#deeefb',
          '200': '#c4e4f9',
          '300': '#9cd2f4',
          '400': '#6db8ed',
          '500': '#3f95e4',
          '600': '#3680da',
          '700': '#2d6cc8',
          '800': '#2b58a2',
          '900': '#274c81',
          '950': '#1c2f4f',
          DEFAULT: '#3f95e4',
        },
      }
    }
  }
}

VS Code settings

Reproduction URL

It isn't necessary. It happens with the most basic tailwind setup. It even happens in tailwind playground you guys built:

https://play.tailwindcss.com/

Describe your issue

So when you first write a class, for example <div class="bg-"></div> it won't show suggestions at all, as shown here: image

However, if you add a space to the string, like this: <div class=" bg-"></div> then it starts showing the suggestions inmediately, as shown here:

image

The expected behavior would be that as soon as I start writing in the class string, it should show the suggestions inmediately.

thecrypticace commented 6 months ago

This happens when autocompleting from a different "provider" (emmet, html snippets, etc…). There was no way for us to hook into this last we checked. It's related to VSCode and/or the Monaco editor (which Play uses). Basically, the APIs we need to make this possible do not exist.

If you were to type <div class= and then press " you'll see completions pop up. But if you type div<tab><arrow-left><space>cl<tab> you can't get completions because you completed the class attribute and Intellisense is not able to trigger a completion when that happens.

I'd have to do some investigating to see if we can work around this in Play but it's not likely. As a workaround you can always press Ctrl+Space to manually trigger completions.

c0h1b4 commented 5 months ago

This also happens with className autocomplete. If you type cl<tab> the completions popup doesn't show.

thecrypticace commented 5 months ago

It's the same limitation.