iamcco / coc-tailwindcss

tailwindcss class name completion for (neo)vim
MIT License
333 stars 29 forks source link

Doesn't prompt suggestions in an Angular project. #51

Open CuriousPhysicist opened 3 years ago

CuriousPhysicist commented 3 years ago

On an Angular project, and using neovim, and installing using vim-plug I can't get coc-tailwindcss to trigger in any *.component.html file.

My set up is as follows:

Angular CLI: 11.1.2
Node: 15.2.0
OS: darwin x64

Angular: 
... 
Ivy Workspace: 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1101.2 (cli-only)
@angular-devkit/core         11.1.2 (cli-only)
@angular-devkit/schematics   11.1.2 (cli-only)
@schematics/angular          11.1.2 (cli-only)
@schematics/update           0.1101.2 (cli-only)
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20201103-57912-svovf1/neovim-0.4.4/build/config -I/tmp/neovim-20201103-57912-svovf1/neovim-0.4.4/src -I/usr/local/include -I/tmp/neovim-20201103-57912-svovf1/neovim-0.4.4/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20201103-57912-svovf1/neovim-0.4.4/build/src/nvim/auto -I/tmp/neovim-20201103-57912-svovf1/neovim-0.4.4/build/include
Compiled by brew@Catalina

init.vim:

...
 " Install plugins {{{                                                                                                                                                                                                                                                           
   70 " https://github.com/junegunn/vim-plug                                                                                                                                                                                                                                          
   71 call plug#begin('~/.local/share/nvim/plugged')                                                                                                                                                                                                                                  
   72 Plug 'thoughtbot/vim-rspec'                                                                                                                                                                                                                                                     
   73 Plug 'tpope/vim-rails'                                                                                                                                                                                                                                                          
   74 Plug 'tpope/vim-fugitive'                                                                                                                                                                                                                                                       
   75 Plug 'tpope/vim-surround'                                                                                                                                                                                                                                                       
   76 Plug 'tpope/vim-rhubarb'                                                                                                                                                                                                                                                        
   77 Plug 'w0rp/ale'                                                                                                                                                                                                                                                                 
   78 Plug 'skalnik/vim-vroom'                                                                                                                                                                                                                                                        
   79 " General use plugins                                                                                                                                                                                                                                                           
   80 Plug 'jgdavey/tslime.vim'                                                                                                                                                                                                                                                       
   81 Plug 'tomasr/molokai'                                                                                                                                                                                                                                                           
   82 Plug 'mileszs/ack.vim'                                                                                                                                                                                                                                                          
   83 Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }                                                                                                                                                                                                               
   84 Plug 'junegunn/fzf.vim'                                                                                                                                                                                                                                                         
   85 Plug 'ludovicchabant/vim-gutentags'                                                                                                                                                                                                                                             
   86 Plug 'christoomey/vim-tmux-navigator'                                                                                                                                                                                                                                           
   87 " Snippet and ending plugins                                                                                                                                                                                                                                                    
   88 Plug 'tpope/vim-endwise'                                                                                                                                                                                                                                                        
   89 Plug 'mattn/emmet-vim'                                                                                                                                                                                                                                                          
   90 Plug 'neoclide/coc.nvim', {'branch': 'release'}                                                                                                                                                                                                                                 
   91 Plug 'iamcco/coc-tailwindcss', {'do': 'yarn install --frozen-lockfile >> /tmp/log 2>&1' }                                                                                                                                                                                       
   92 " python related plugins                                                                                                                                                                                                                                                        
   93 Plug 'lepture/vim-jinja'                                                                                                                                                                                                                                                        
   94 call plug#end()                                                                                                                                                                                                                                                                 
   95 " }}}

To Reproduce Steps to reproduce the behavior:

>  ng new test-tailwindcss-bug
... Accept defaults by pressing 'Enter'
... NB ng cli configured to use yarn rather than npm (ng config -g cli.packageManager yarn)
> cd test-tailwindcss-bug
... open neovim and go to the application component HTML file
> nvim src/app/application.component.html

below the closing style tag delete the boilerplate and replace with a simple h1 tag

...
</style>                                                                                                                                                                                                                                                                          

<h1>Hello World!</h1>   

add a class attribute and attempt to trigger coc prompt window ... doesn't work.

Run :PlugInstall! to force a re-installation of plugins...

yar raises error messages:

yarn install v1.22.10
[1/5] Validating package.json...
warning coc-tailwindcss@0.7.0: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
success Already up-to-date.
$ npm-run-all clean build
yarn run v1.22.10
warning coc-tailwindcss@0.7.0: The engine "coc" appears to be invalid.
$ rm -rf ./out
Done in 0.07s.
yarn run v1.22.10
warning coc-tailwindcss@0.7.0: The engine "coc" appears to be invalid.
$ webpack
Hash: 722961ec531a305609a3
Version: webpack 4.41.2
Time: 1984ms
Built at: 10/02/2021 08:04:19
   Asset     Size  Chunks             Chunk Names
index.js  125 KiB       0  [emitted]  index
Entrypoint index = index.js
  [0] external "path" 42 bytes {0} [built]
  [7] external "stream" 42 bytes {0} [built]
  [9] external "os" 42 bytes {0} [built]
 [12] external "fs" 42 bytes {0} [built]
 [18] external "coc.nvim" 42 bytes {0} [built]
 [20] external "util" 42 bytes {0} [built]
 [29] external "net" 42 bytes {0} [built]
 [30] ./src/index.ts 7.07 KiB {0} [built]
 [60] external "events" 42 bytes {0} [built]
 [81] ./src/headwind.ts 4.53 KiB {0} [built]
 [87] external "crypto" 42 bytes {0} [built]
 [99] ./src/utils.ts 1.27 KiB {0} [built]
[100] external "child_process" 42 bytes {0} [built]
[101] external "rustywind" 42 bytes {0} [built]
    + 88 hidden modules
Done in 3.17s.
Done in 4.37s.

Check extensions with :CocList extensions

 * coc-tailwindcss [RTP] 0.7.0 ~/.local/share/nvim/plugged/coc-tailwindcss                                                                                                                                                                                                           
  + coc-tsserver 1.6.7 ~/.config/coc/extensions/node_modules/coc-tsserver                                                                                                                                                                                                             
  + coc-json 1.3.4 ~/.config/coc/extensions/node_modules/coc-json  

but in the HTML file the services don't include tailwindcss

Run :CocList services
  No results, press ? on normal mode to get help.

Expected behavior When entering text the tailswindcss language server should be providing suggestions when in a suitable file type.

Screenshots

image

This list should include suggestions like bg-gray-400 with a [LS] tag at the end.

Desktop (please complete the following information):

kuntau commented 3 years ago

Check your filetype if it's any of the following

tailwindCSS.cssLanguages css languages completion support, default:

[ "css", "less", "postcss", "sass", "scss", "stylus", "vue" ]

tailwindCSS.jsLanguages javascript languages completion support, default:

[ "javascript", "javascriptreact", "reason", "typescriptreact" ]

tailwindCSS.htmlLanguages html languages completion support, default:

[ "blade", "edge", "eelixir", "ejs", "elixir", "elm", "erb", "eruby", "haml", "handlebars", "htmldjango", "html", "HTML (EEx)", "HTML (Eex)", "html.twig", "jade", "leaf", "markdown", "njk", "nunjucks", "php", "razor", "slim", "svelte", "twig", "vue" ]

travisp commented 3 years ago

I'm having the same issue in haml documents in my rails project. Works fine in css.

Edit: actually, it seems like my problem may be different as the upstream library doesn't truly support haml out of the box yet, without an experimental setting change: tailwindlabs/tailwindcss#7553