Skip to content

not working in project with tailwindcss config in subdir #668

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
merrickluo opened this issue Nov 21, 2022 · 5 comments
Closed

not working in project with tailwindcss config in subdir #668

merrickluo opened this issue Nov 21, 2022 · 5 comments

Comments

@merrickluo
Copy link
Contributor

What version of Tailwind CSS IntelliSense are you using?

v0.9.1

What version of Tailwind CSS are you using?

v3.2.2

What package manager are you using?

npm

What operating system are you using?

Linux

Tailwind config

N/A

VS Code settings

"tailwindCSS.includeLanguages": {
    "html-eex": "html"
},

Reproduction URL

Describe your issue
Hi, I recently find that tailwindcss-intellisence does not work in phoenix projects that use tailwindcss in the eex/leex/heex templates. I did some debugging and found that the language server didn't treat the template files as in the project.
the folder structure for a phoenix project is like this:

project
  - assets
    - tailwindcss.config.js
  - lib
    - project_web
      - live
        - template.html.heex
      - templates
        - view_name
          - view.html.eex
  ....

in the log:

  "message": "[Global] Creating projects: [{\"folder\":\"/home/xxx\",\"configPath\":\"/home/xxx/assets/tailwind.config.js\",\"isUserConfigured\":false,\"documentSelector\":[{\"pattern\":\"/home/xxx/assets/tailwind.config.js\",\"priority\":0},{\"pattern\":\"/home/xxx/assets/**\",\"priority\":3}]}]"

it seems only look up to the assets/** hence all the template files got ignored.
do you think if it's ok to add a documentselector directly to root?

@bradlc
Copy link
Contributor

bradlc commented Nov 21, 2022

Hi @merrickluo. Please can you share a GitHub repository that I can open to reproduce the issue in VS Code?

@merrickluo
Copy link
Contributor Author

Thanks for the reply, I tried to reproduce with a new project, but it works in new project
new:
image
old:
image

somehow my project is missing the project root selector with priority 4. I don't recall any obvious differences between those two projects regarding the tailwindcss setup, I'll try debug more with the old project and report back, thanks again.

@merrickluo
Copy link
Contributor Author

Hi again @bradlc. I find out the difference now. phoenix now uses esbuild by default, the assets/package.json file is only created when adding npm packages. in getPackageRoot treat the folder contains package.json the rootDirectory.

here is an example project: https://github.com/merrickluo/phoenixtw thanks again for taking a look!

@bradlc
Copy link
Contributor

bradlc commented Jan 27, 2023

Hey @merrickluo, this should be fixed in v0.9.7 👍 The root selector will be added if there's exactly one active "project"

@merrickluo
Copy link
Contributor Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants