You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatic syntax highlighting with .rs files does not work #306
After saved ~/.vimrc, run :PlugInstall in vim or $ vim +PlugInstall +qall on terminal.
Expected vs. actual behavior:
Expected:
When I opened rust source file with .rs extension, for example main.rs, then vim automatically highlights Rust syntax.
(And this is the actual behavior until commit 329fa78.)
Actual:
With commit 12f549f, vim automatically highlights syntax but it is not for Rust.
When I run :set syntax=rust manually, then Rust syntax highlight works.
I cannot get additional debug information because :RustInfo failed with E492 error.
changed the title [-]Automatic syntax highlighting with .rs files does not work from 12f549f[/-][+]Automatic syntax highlighting with .rs files does not work[/+]on Feb 8, 2019
I can’t reproduce this on Vim 8.1.1 on Windows, probably for the reasons mentioned below.
This smells like another ftdetect rule butting in first, thereby triggering exactly the deliberate and intended difference between setfiletype rust and set filetype=rust.
Please run this to determine what the filetype actually is on a .rs file, and where it was last set:
:verbose set filetype?
Working from distant memories of such truly ancient versions of Vim worked out of the box, I expect the answer will be hercules from $VIMRUNTIME/filetype.vim. (For I observe even now that my own Vim has it set to rust from $VIMRUNTIME/filetype.vim rather than the rust.vim ftdetect.vim, suggesting that it’s currently basically only working because Vim already knows about Rust.)
I shan’t look into it now, but we may need to do some autocmd group rejiggering or something to gain higher priority than it (if that’s possible), without clobbering it altogether (because set filetype=rustis still definitely the wrong thing to do, even if this may now explain why it was that way). I’ll think about it more some other time, probably at least a few days hence. If suitable augroup fiddling isn’t possible, maybe we just clobber it iff filetype=hercules.
Activity
[-]Automatic syntax highlighting with .rs files does not work from 12f549f[/-][+]Automatic syntax highlighting with .rs files does not work[/+]chris-morgan commentedon Feb 8, 2019
I can’t reproduce this on Vim 8.1.1 on Windows, probably for the reasons mentioned below.
This smells like another ftdetect rule butting in first, thereby triggering exactly the deliberate and intended difference between
setfiletype rustandset filetype=rust.Please run this to determine what the filetype actually is on a .rs file, and where it was last set:
Working from distant memories of such truly ancient versions of Vim worked out of the box, I expect the answer will be hercules from $VIMRUNTIME/filetype.vim. (For I observe even now that my own Vim has it set to rust from $VIMRUNTIME/filetype.vim rather than the rust.vim ftdetect.vim, suggesting that it’s currently basically only working because Vim already knows about Rust.)
I shan’t look into it now, but we may need to do some autocmd group rejiggering or something to gain higher priority than it (if that’s possible), without clobbering it altogether (because
set filetype=rustis still definitely the wrong thing to do, even if this may now explain why it was that way). I’ll think about it more some other time, probably at least a few days hence. If suitable augroup fiddling isn’t possible, maybe we just clobber it iff filetype=hercules.chris-morgan commentedon Feb 8, 2019
Oh, and about the
:RustInfo: that’s from ftplugin/rust.vim, so it’s only available once you load a Rust file.yeonsookimdev commentedon Feb 11, 2019
@chris-morgan The output of
:verbose set filetype?withmain.rsis:Improve filetype setting