bluz71 / vim-nightfly-colors

A dark midnight theme for modern Neovim & classic Vim
MIT License
828 stars 51 forks source link

Unused variables in TypeScript barely legible #25

Closed wavded closed 3 years ago

wavded commented 3 years ago

I'm running into this issue

Screen Shot 2021-08-26 at 2 32 10 PM

Testing other languages seems to be fine in this case. I'm using coc.nvim. I am using tree-sitter and do not have any other specific syntax plugins for TypeScript. Could something be interfering?

bluz71 commented 3 years ago

Yes, something is quite wrong.

I quickly hacked together a TypeScript file with your statements and had no issue, the let local variables were coloured white rather than faded grey.

A couple suggestions:

Strange one.

wavded commented 3 years ago

Install the nvim-treesitter/playground plugin and then place the cursor on top of the greyed-out variables and then do :TSHighlightCapturesUnderCursor. Let me know what you get.

Screen Shot 2021-08-27 at 10 14 25 AM

Temporarily disable COC and see what that does.

It goes back to white text!

Can you provide me access that TypeScript file so I can experiment.

Basically any unused variable, so a file with just this:

for (let t of ts) {
}

Would gray out the t.

Screen Shot 2021-08-27 at 10 17 47 AM

I'm going to look into coc.nvim more, seems like that did cause the issue.

wavded commented 3 years ago

Looks like its using CocUnusedHighlight:

https://github.com/neoclide/coc.nvim/blob/94fb1527f4be1b499029ef76cb90e73a384d063f/plugin/coc.vim#L370

wavded commented 3 years ago

Adding this to my init.vim seems to fix it, doesn't seem like a great long term solution but works:

hi link CocUnusedHighlight TSVariable
bluz71 commented 3 years ago

Thanks for debugging this.

It is confirmed that CoC is overlaying its own highlighting over the top of Treesitter. I strongly believe this is not wanted, it does more harm than good especially since Treesitter does excellent highlighting by itself.

Quickly looking at CoC documentation lists these two options that you should experiment with:

Let me know which one works, I will then update the README here noting that CoC users should disable semantic highlighting or CoC color support.

Cheers.

bluz71 commented 3 years ago

@wavded,

Any updates on this? Did you manage to disable CoC highlighting?

Cheers.

wavded commented 3 years ago

@bluz71 I just attempted these things:

g:coc_default_semantic_highlight_groups = 0, this should already be defaulted to off in newer versions of CoC. Please double check at your end that symantic highlighting is disabled.

Setting this to 0 didn't make a difference.

coc.preferences.colorSupport, this appears to be defaulted to true. This could be the problem. Please set this to false and try again.

Setting this to false also did not make a difference.

Seems the only thing that works so far is hi link CocUnusedHighlight TSVariable in my init.vim.

bluz71 commented 3 years ago

This genuinely seems like a fault with CoC.

It should not be highlighting anything if you do not want it to. If I were you I would open up an issue at the CoC issue tracker. This is very annoying of CoC, it is doing way too much, it seems silly of them to also be doing highlighting.

But it is up to you. If you gather some information, please let me know.

bluz71 commented 3 years ago

Closing this since this is a CoC issue. CoC should offer a working option to completely disable their own unwanted highlighting.

bluz71 commented 3 years ago

Another user has reported this Coc issue.

Hence, in this colorscheme I now link CocUnusedHighlight to White. So you shouldn't need your own link-fix anymore.

Are there any other Coc highlight issues I need to fix?

wavded commented 3 years ago

Thx for the fix @bluz71, mine works well now without the fix I did. I haven't noticed any other issues.