nvim-ts-context-commentstring icon indicating copy to clipboard operation
nvim-ts-context-commentstring copied to clipboard

`set ft?` return `filetype=on` and causing losing syntax highlighting

Open kohane27 opened this issue 1 year ago • 4 comments

Minimal reproducible full config

Please see the video below. Thank you!

Description

:set ft? return filetype=on and causing losing syntax highlighting

Actual behavior

https://github.com/JoosepAlviste/nvim-ts-context-commentstring/assets/57322459/a63603f9-0d4b-4767-8446-9fb4b80e53f9

kohane27 avatar Nov 20 '23 13:11 kohane27

That seems quite weird, I couldn't reproduce the issue. Did this just start happening recently? There were some breaking changes merged a day or 2 ago: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/issues/82 but I don't know if they would cause such issues.

One thing to try would be to update your Neovim version, I think that one of the recent PRs that was merged required Neovim version 0.9.4 as it uses some newer Treesitter APIs.

If that doesn't help, then could you post a minimal configuration where the issue could be reproduced (based on https://github.com/JoosepAlviste/nvim-ts-context-commentstring/blob/main/utils/minimal_init.lua)? The PR template should have instructions for starting a new minimal config: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/blob/main/.github/ISSUE_TEMPLATE/bug_report.yml.

JoosepAlviste avatar Nov 20 '23 18:11 JoosepAlviste

Thank you for getting back to me. I appreciate it!

I can confirm this bug only exists after the BR a few days ago.

I'm currently on Neovim 0.9.4:

:version
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891

I'll look into it and provide the minimal config.

Thank you again for creating this awesome plugin!

kohane27 avatar Nov 23 '23 15:11 kohane27

Apologies for my late reply. I still have no idea why the latest commit would not work, but I found the commit before the BR works:

{ "JoosepAlviste/nvim-ts-context-commentstring", commit = "6c30f3c8915d7b31c3decdfe6c7672432da1809d" },

I think I'll stick to it for now. I'll debug when I have time. Thank you!

kohane27 avatar Nov 30 '23 04:11 kohane27

Not sure what the issue could be since I can't reproduce it 😕 on is such a weird value for filetype to have...

The only thing I can think of right now would be to use the minimal config as a base to try to reproduce it, adding small bits of your configuration at a time.

By the way, if you manually do :set filetype=lua in a Lua file, then does it provide the correct highlighting and commentstring updating?

JoosepAlviste avatar Nov 30 '23 17:11 JoosepAlviste

@JoosepAlviste Hello! Hope you're doing well.

I finally realized the problem. For some reason in option.lua I have the following:

opt.filetype = "on"

And this was the cause of the bug. After removing this faulty line, nvim-ts-context-commentstring works flawlessly again.

My apologies and thank you again. Have a good day!

kohane27 avatar Feb 04 '24 14:02 kohane27