ultisnips icon indicating copy to clipboard operation
ultisnips copied to clipboard

how to change filetype detection strategy?

Open qian-gu opened this issue 2 years ago • 0 comments

Expected behavior:

Change filetype detection into whole word match, the default wildcard way doesn't support overwriting in language like foo and foobar.

For example, I have extended a systemverilog.snippets from verilog.snippets,

in verilog.snippets file:

priority -50

snippet comb "Infer combinational from always" b
always @(*) begin
	${1:${VISUAL}}
end
$0
endsnippet

in the systemverilog.snippets file:

priority -50

extends verilog

# We want to overwrite everything in parent ft.
priority -49

snippet comb "Infer combinational from always_comb" b
always_comb begin
	${1:${VISUAL}}
end
$0
endsnippet

comb<tab> is expected to be replaced with always @(*) in verilog file and always_comb in systemverilog file.

Actual behavior:

For previous example, comb<tab> in any verilog file will be replaced with always_comb instead of always @(*).

Steps to reproduce

  1. install ultisnips and honza/vim-snippets plugins
  2. disable searching snipmate snippets by adding let g:UltiSnipsEnableSnipMate = 0 to .vimrc
  3. open test.v file and set filetype with :set filetype=verilog
  4. test with previous example, i.e., write comb<tab>

  • Operating System:

Ubuntu 22.04

  • Vim Version:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 13 2022 09:35:02) Included patches: 1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919

  • UltiSnips Version:

e99fdf15cd55a4a8e0cb0a80a6810c1867a5c401

  • Python inside Vim:

5.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0]

  • Docker repo/vimrc:

qian-gu avatar Nov 06 '22 16:11 qian-gu