Skip to content
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

cannot use with typescript #4

Open
andykais opened this issue Sep 6, 2019 · 3 comments
Open

cannot use with typescript #4

andykais opened this issue Sep 6, 2019 · 3 comments

Comments

@andykais
Copy link

andykais commented Sep 6, 2019

When writing typescript, you must specify a typescript syntax highlighter. A popular one is Darkholme/yats.vim. It does not always work well with templated strings. Attached are a working and non-working tagged template string
screenshot(196)
screenshot(195)

@andykais
Copy link
Author

I was mistaken, it turns out this was an issue with typescript syntax regardless of yats. Here is the same contents inside a javascript file:
screenshot(207)

and a typescript file:
screenshot(206)

repro info:
this was using a super small init.vim

call plug#begin('~/.config/nvim/plugged')
Plug 'cdata/vim-tagged-template'
call plug#end()

let g:taggedtemplate#tagSyntaxMap = {
  \ "sql": "sql" }

autocmd FileType javascript,typescript : call taggedtemplate#applySyntaxMap()
$ nvim --version
NVIM v0.4.2
Build type: Release
LuaJIT 2.0.5

ran like so:

nvim -u init.vim template.sql.ts

@andykais
Copy link
Author

it appears to be an issue with the parent repository as well Quramy#15

@andykais
Copy link
Author

so I was able to repro my issue with an even smaller configuration, without using this plugin. All it takes is the following snippet in ~/.config/nvim/after/syntax/typescript.vim

unlet b:current_syntax
syn include @SQL syntax/sql.vim
syn region sqlTemplate start=+sql`+
        \ end=+`+
        \ contains=@SQL
v --noplugin test.ts
// highlighted as sql
sql`SELECT * WHERE`
// not highlighted as sql
const x = sql`SELECT * WHERE`

I suppose that means its time to move this issue upstream to neovim.

@andykais andykais changed the title does not play nicely with yats.vim cannot use with typescript May 25, 2021
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

1 participant