Skip to content

TypeScript Support #12

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

Open
K-NRS opened this issue May 8, 2020 · 17 comments
Open

TypeScript Support #12

K-NRS opened this issue May 8, 2020 · 17 comments

Comments

@K-NRS
Copy link

K-NRS commented May 8, 2020

Hello, the plugin is the best in vim javascript syntaxes. It would be nice to have a syntax plugin for TypeScript too. What do you think about this?

@yuezk
Copy link
Owner

yuezk commented May 8, 2020

Which plugin are you using for highlighting TypeScript now?

@K-NRS
Copy link
Author

K-NRS commented May 8, 2020

# Plug 'leafgarland/typescript-vim'  
Plug 'HerringtonDarkholme/yats.vim'  
Plug 'peitalin/vim-jsx-typescript'

These are. But so bad. Almost like syntax off.

@zorgick
Copy link

zorgick commented May 8, 2020

@K-NRS Maybe you have something else in your config that disturbs language highlighting for typescript. Check, if you have this command set regexpengine = 1, and better delete it for good, because that broke my ts highlight with any plugin.
Currently I'm using this trio,

Plug 'yuezk/vim-js'                                                                                                                                                                                              
Plug 'HerringtonDarkholme/yats.vim'                                               
Plug 'maxmellon/vim-jsx-pretty'

and it covers all my needs in webdev, even in complex files, like in the picture
image

@K-NRS
Copy link
Author

K-NRS commented May 9, 2020

@zorgick I dont think the problem is about regexpengine and i couldn't see anything related to typescript in your picture. I have no problem with js files. I just wanted to ask, "will this plugin have TypeScript support?"

My vim shows .ts and .tsx files like this:
image

It doesn't even look like javascript files colorized by yuezk/vim-js and happens "'redrawtime' exceeded, syntax highlighting disabled" in some .ts and .tsx files. Not comfortable at all.

@yuezk
Copy link
Owner

yuezk commented May 9, 2020

@K-NRS How about replace Plug 'peitalin/vim-jsx-typescript' with Plug 'maxmellon/vim-jsx-pretty' and try again?

@zorgick
Copy link

zorgick commented May 9, 2020

@K-NRS the point is in the separation of concerns. Vim-js is a wonderful plugin that can't treat your js file any better. Yats is a reliable plugin that will do the same for your ts files. Thus, it is a redundancy to repeat the funtionality of yats in vimjs plugin.

Please reconsider your config, and try to make it as minimalistic as possible. You'd rather leave ONLY these 3 plugins, that I use, and check if your highlighting works.

Refer to this problem about regexengine click.

The picture I provided is a tsx file of 1200 lines. Without yats vim would highlight only exports, this and const/let, leaving jsx as simple text.

@K-NRS
Copy link
Author

K-NRS commented May 9, 2020

@yuezk still it's almost the same.
image

When i look at scriptnames, i only see yats and vim-jsx-pretty as typescript plugin. And does not colorize function names, dots and operators (?. , || , &&) etc...

My vimrc file is already pretty minimal. But I will try with a much simpler vimrc in a container. I saw /usr/share/nvim/runtime/syntax/typescript.vim at the end of the scriptnames.

@yuezk
Copy link
Owner

yuezk commented May 9, 2020

@K-NRS Just curious, which plugin do you use to add this?

image

@yuezk
Copy link
Owner

yuezk commented May 9, 2020

@zorgick I also want to know which plugin are you using for adding the lint message here?
image

I was looking for this feature for a long time.

@K-NRS
Copy link
Author

K-NRS commented May 9, 2020

@yuezk Neovim with coc.nvim. Enable its codeLens or make diagnostic.virtualText: true

@zorgick
Copy link

zorgick commented May 9, 2020

@yuezk it's vim-lsp. I switched to it after coc, and it's really fast and easy to set up

@glepnir
Copy link

glepnir commented May 19, 2020

@K-NRS I also use them, these is behavior on my vim

HerringtonDarkholme/yats.vim, 
MaxMEllon/vim-jsx-pretty,on_ft

image

@glepnir
Copy link

glepnir commented May 19, 2020

Notice that the vim and neovim had add the typescript syntax based on HerringtonDarkholme/yats.vim, neovim/neovim@bd23fef
vim/vim@12ee7ff
,

@K-NRS
Copy link
Author

K-NRS commented May 19, 2020

@K-NRS I also use them, these is behavior on my vim

HerringtonDarkholme/yats.vim, 
MaxMEllon/vim-jsx-pretty,on_ft

image

My current configuration too is like that now. The syntax could not be colored like VSCode in Vim. I accepted this until there is a new change.

@glepnir
Copy link

glepnir commented May 19, 2020

@K-NRS you can get the current cursor word syntaxt group then check what color set and config it.You may not be able to get the same colorscheme as vscode. Syntax highlight via regular configuration in vim may conflict with other highlight plugins, such as rainbow.vim. The current highlighting is easier for me to accept. This is my colorscheme and i config typescript support you can reference it.

https://github.com/hardcoreplayers/oceanic-material/blob/fdf2f35f4677a241c2c66c66e0f700ee9e45db72/colors/oceanic_material.vim#L595

@pkradiator
Copy link
Contributor

@zorgick Unrelated but what colorscheme is this?

@zorgick
Copy link

zorgick commented Nov 17, 2024

@pkradiator onehalf light https://github.com/sonph/onehalf

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

5 participants