jonsmithers / vim-html-template-literals

Syntax highlighting for html template literals in javascript (as in lit-html and polymer 3)
MIT License
71 stars 10 forks source link

Compatibility with coc.nvim #14

Closed utrumo closed 4 years ago

utrumo commented 5 years ago

How can i make it work with https://github.com/neoclide/coc.nvim and https://github.com/neoclide/coc-tsserver?

jonsmithers commented 5 years ago

I don't think tsserver is natively supporting html template literals right now. I have managed to get typescript-lit-html-plugin to work in coc.nvim. You might give that a shot.

eli-rodriguezperez commented 5 years ago

My current setup to work on lit-html in vim is using the typescript-lit-html-plugin with coc-tsserver. Would be nice if it could detect string litterals and show coc-html suggestions in those parts. Dunno how impossible it is to get it working though.

utrumo commented 5 years ago

My current setup to work on lit-html in vim is using the typescript-lit-html-plugin with coc-tsserver. Would be nice if it could detect string litterals and show coc-html suggestions in those parts. Dunno how impossible it is to get it working though.

How you make it work with vim and coc?

eli-rodriguezperez commented 5 years ago

I just have all of them installed and they work. coc.nvim and typescript-lit-html-plugin with VimPlug, coc-tsserver as an extension.

utrumo commented 5 years ago

I just have all of them installed and they work. coc.nvim and typescript-lit-html-plugin with VimPlug, coc-tsserver as an extension.

Can you show me config strings for vimPlug?

How do you add

"compilerOptions": {
    "plugins": [
      {
        "name": "typescript-lit-html-plugin"
      }
    ]
  }

to coc-tslint tsconfig.json?

jonsmithers commented 5 years ago

Would be nice if it could detect string litterals and show coc-html suggestions in those parts. Dunno how impossible it is to get it working though.

Yeah, I imagine that would be useful in some scenarios. I think someone would need to fork typescript-lit-html-plugin and first figure out how to enable it on ALL string literals. Enabling it intelligently for some literals but not others might be impossible.

(By the way, there is currently an experimental g:htl_all_templates to add html syntax highlighting to ALL template string literals in vim.)


If typescript-lit-html-plugin were to add a section in their readme for using it with vim, I think it might look like this:

With NeoVim

Install coc.nvim and run :CocInstall coc-tsserver.

Install the plugin and a copy of TypeScript in your workspace:

npm install --save-dev typescript-lit-html-plugin typescript

Then add a plugins section to your tsconfig.json or jsconfig.json

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-lit-html-plugin"
      }
    ]
  }
}