Giter Site home page Giter Site logo

Comments (10)

thekaganugur avatar thekaganugur commented on June 9, 2024 31

Here is a workaround for using LSP directly. You will need to install lsp globally.

yarn global add @tailwindcss/language-server

  "languageserver": {
    "tailwind-lsp": {
      "command": "tailwindcss-language-server",
      "args": ["--stdio"],

      "filetypes": [
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact"
      ],

      "rootPatterns": [
        "tailwind.config.js",
        "tailwind.config.ts",
        "postcss.config.js",
        "postcss.config.ts",
        "package.json",
        "node_modules",
        ".git"
      ],
      "settings": {
        "tailwindCSS": {
          "validate": true,
          "lint": {
            "cssConflict": "warning",
            "invalidApply": "error",
            "invalidScreen": "error",
            "invalidVariant": "error",
            "invalidConfigPath": "error",
            "invalidTailwindDirective": "error",
            "recommendedVariantOrder": "warning"
          },
          "classAttributes": ["class", "className", "classList", "ngClass"],
          "experimental": {}
        }
      }
    }
  }

from coc-tailwind-intellisense.

yaegassy avatar yaegassy commented on June 9, 2024 5

I created a PR for tailwindcss v3 support on the repository side of coc-tailwindcss. If you are interested, please try it out. iamcco/coc-tailwindcss#70

from coc-tailwind-intellisense.

getnashty avatar getnashty commented on June 9, 2024 4

looks like this breaks with tailwindcss 3.0.0... when I moved the react projects version down to 2.2.19 it worked fine

from coc-tailwind-intellisense.

terminalkitten avatar terminalkitten commented on June 9, 2024 3

@kgnugur

Hi, thanks for your work-around, it's indeed enabling code-completion for tailwindcss > 3.0.x.

But i'm also using tailwind in django-html templates, and I'm having some trouble figuring out how to enable it with your config?

  • If I set filetype from htmldjango -> html the LS picks up and starts code-completion / enhancements for the file, but I lose some handy features from coc-htmldjango.

I've tried the following configuration with no success:

"languageserver": {
    "tailwind-lsp": {
      "command": "tailwindcss-language-server",
      "args": ["--stdio"],
      "filetypes": [
        "html",
        "htmldjango",
        "django-html",
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact"
      ],

      "rootPatterns": [
        "tailwind.config.js",
        "tailwind.config.ts",
        "postcss.config.js",
        "postcss.config.ts",
        "package.json",
        "node_modules",
        ".git"
      ],
      "settings": {
        "tailwindCSS": {
          "includeLanguages": {
            "htmldjango": "html",
            "django-html": "html"
          },
          "validate": true,
          "lint": {
            "cssConflict": "warning",
            "invalidApply": "error",
            "invalidScreen": "error",
            "invalidVariant": "error",
            "invalidConfigPath": "error",
            "invalidTailwindDirective": "error",
            "recommendedVariantOrder": "warning"
          },
          "classAttributes": ["class", "className", "classList"],
          "experimental": {}
        }
      }
    }
}

from coc-tailwind-intellisense.

oieeaaaa avatar oieeaaaa commented on June 9, 2024 3

Here is a workaround for using LSP directly. You will need to install lsp globally.

yarn global add @tailwindcss/language-server

  "languageserver": {
    "tailwind-lsp": {
      "command": "tailwindcss-language-server",
      "args": ["--stdio"],

      "filetypes": [
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact"
      ],

      "rootPatterns": [
        "tailwind.config.js",
        "tailwind.config.ts",
        "postcss.config.js",
        "postcss.config.ts",
        "package.json",
        "node_modules",
        ".git"
      ],
      "settings": {
        "tailwindCSS": {
          "validate": true,
          "lint": {
            "cssConflict": "warning",
            "invalidApply": "error",
            "invalidScreen": "error",
            "invalidVariant": "error",
            "invalidConfigPath": "error",
            "invalidTailwindDirective": "error",
            "recommendedVariantOrder": "warning"
          },
          "classAttributes": ["class", "className", "classList", "ngClass"],
          "experimental": {}
        }
      }
    }
  }

Dude, this saved me!

from coc-tailwind-intellisense.

izaguirrejoe avatar izaguirrejoe commented on June 9, 2024 2

Also waiting for fix

from coc-tailwind-intellisense.

thekaganugur avatar thekaganugur commented on June 9, 2024 1

I'm switching over to built-in lsp because of this issue. It's a nightmare. Hours of configuration is wasted.

Is there any update on this issue? Thanks.

from coc-tailwind-intellisense.

cwahlfeldt avatar cwahlfeldt commented on June 9, 2024 1

Me too. The vscode plugin seems to be working fine. Maybe its just a matter of upgrading the tailwind intellisense sub module?

from coc-tailwind-intellisense.

legecha avatar legecha commented on June 9, 2024 1

Me too. The vscode plugin seems to be working fine. Maybe its just a matter of upgrading the tailwind intellisense sub module?

Also would love an update to this. 0.7.4 is out now with TailwindCSS v3 support. I even tried to fork this and do an upgrade myself but sadly I've not enough experience in this area.

I did notice the submodule needed updating to as the URL has changed from https://github.com/tailwindcss/intellisense to https://github.com/tailwindlabs/tailwindcss-intellisense as well.

from coc-tailwind-intellisense.

AnishDe12020 avatar AnishDe12020 commented on June 9, 2024

Here is a workaround for using LSP directly. You will need to install lsp globally.

yarn global add @tailwindcss/language-server

  "languageserver": {
    "tailwind-lsp": {
      "command": "tailwindcss-language-server",
      "args": ["--stdio"],

      "filetypes": [
        "javascript",
        "javascriptreact",
        "typescript",
        "typescriptreact"
      ],

      "rootPatterns": [
        "tailwind.config.js",
        "tailwind.config.ts",
        "postcss.config.js",
        "postcss.config.ts",
        "package.json",
        "node_modules",
        ".git"
      ],
      "settings": {
        "tailwindCSS": {
          "validate": true,
          "lint": {
            "cssConflict": "warning",
            "invalidApply": "error",
            "invalidScreen": "error",
            "invalidVariant": "error",
            "invalidConfigPath": "error",
            "invalidTailwindDirective": "error",
            "recommendedVariantOrder": "warning"
          },
          "classAttributes": ["class", "className", "classList", "ngClass"],
          "experimental": {}
        }
      }
    }
  }

After installing the package, how do I go about using it? I am currently using nvim-cmp (for completion) and nvim-lsp-installer (to manage language servers)

from coc-tailwind-intellisense.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.