neoclide / coc-html

Html language server extension for coc.nvim.
207 stars 6 forks source link

Enable coc-html for other filetypes #8

Closed AdrienLemaire closed 3 years ago

AdrienLemaire commented 4 years ago

Related: #4, #5

I would like the coc-html ipc to be started on .html files with filetype=htmldjango.

Expected:

  "html.filetypes": [
    "htmldjango",
    "html"
  ],

would start coc-html on files with filetype = html or htmldjango

Currently: Only files with filetype=html are started.

let g:coc_filetype_map = {
  \ 'htmldjango': 'html',
  \ }

is not a proper fix, because formatting an htmldjango file will ignore django template tags and format as if it was a regular html file.

Other plugins, like coc-tailwindcss, behave nicely. I couldn't figure out how coc plugins are getting started based on the filetype, so do not know a proper fix for this issue.

lippirk commented 4 years ago

i had a similar issue with .hbs files, and fixed it by adding the following to my init.vim

autocmd BufEnter *.hbs :set ft=html

i couldn't get it to work with set ft=hbs, adding hbs to the coc_filetype_map, and also adding hbs to the filetypes in coc-settings.json

ryanlinnane commented 4 years ago

Same problem as @lippirk can we reopen this @chemzqm ?

jorgeav527 commented 4 years ago

same issue here and for that reason coc-snippets can't load htmldjango.snippets @chemzqm I add all the config above witch @AdrienLemaire mentioned, update NPM, adding coc-html config, g:coc_filetype_map. others suggestions pls

zatloeri commented 3 years ago

I am having the same problem. Cannot make twig files work using

let g:coc_filetype_map = {
  \ ...
  \ }

Only autocmd BufEnter *.html.twig :set ft=html works

Am I doing something wrong, or is this a problem on the lib side?