[vim/vim] puppet files "*.pp" now being seen as pascal syntax! (#7305)

36 views
Skip to first unread message

Anthony Thyssen

unread,
Nov 15, 2020, 9:41:06 PM11/15/20
to vim/vim, Subscribed

Instructions: Replace the template text and remove irrelevant text (including this line)

Describe the bug
When editing puppet configuration files of type *.pp the syntax highlighting is now pascal, rather than puppet

To Reproduce
Detailed steps to reproduce the behavior:

vim --clean file.pp
:set filetype

result output is filetype=pascal

This happens regardless of if "file.pp" exists (and is a valid puppet configuration file) or not

Expected behavior
Based on the suffix or content the filetype (and this syntax highlighting) is set to puppet.

Screenshots

Environment (please complete the following information):

  • VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 29 2020 00:00:00)
    Included patches: 1-1770
  • OS: fedora 31
  • Terminal:xterm though not applicable.

Additional context

A search reviled that ANY file with a ".pp" suffix will now be though of as being "pascal"
Line 1165 of the vim82 system file "filetype.vim"

au BufNewFile,BufRead *.pas,*.pp		setf pascal

However NOT all files with this suffix are pascal!

A check on the GIT blame, shows this ws added 2 months ago, by...
patch 8.2.1725: not all Pascal files are recognized
44aaf54

Currently I am overriding this with a personal workaround...

" the /usr/share/vim/vim82/filetype.vim file sets '.pp' as pascal!
au BufNewFile,BufRead *.pp            setf puppet

Though previously this was not needed.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Doug Kearns

unread,
Nov 16, 2020, 7:05:52 AM11/16/20
to vim/vim, Subscribed

It seems to me that as a matter of principle this should be fixed in vim-puppet (assuming that's what you're using) until such time as they decide to be included in the official runtime distribution.

However, is there an easy way to detect Puppet files from their content? I'm unfamiliar with the file format so perhaps it's easier to do for Pascal?

Ilhaan Rasheed

unread,
Nov 16, 2020, 1:25:58 PM11/16/20
to vim/vim, Subscribed

Just noticed this starting today as well.

Ilhaan Rasheed

unread,
Nov 16, 2020, 1:30:00 PM11/16/20
to vim/vim, Subscribed

@dkearns Looks like vim-puppet does set this config here

Anthony Thyssen

unread,
Nov 17, 2020, 12:19:31 AM11/17/20
to vim/vim, Subscribed

I don't think there is a easy way to say it is a puppet file. Though most puppet *.pp files are located under a directory named "Manifests".
Running "file" on the files, shows that command thinks of the *.pp files as either "ASCII text" or "C++ source, ASCII text"
The later probably from seeing "class {" strings within the file. I don't have any pascal files myself.

Basically declaring all files of name "*.pp" a particual filetype works for ME on a personal level,
but it probably should not be an assumption that is made at system level.

Anthony Thyssen

unread,
Nov 17, 2020, 12:28:50 AM11/17/20
to vim/vim, Subscribed

@dkearns No sorry I am not using vim-puppet. It is not part of the normal vim-enhanced distribution.

However having a look...
I did have a personal files "vim/ftdetect/puppet.vim" with

au BufRead,BufNewFile *.pp setf puppet

in it. This obviously what was being used previously before the system "filetype.vim" file overrode it for "pascal"
I also have a personal file... "vim/syntax/puppet.vim" providing the appropriate syntax.

So I suppose the problem boils down to that this new system "filetype.vim" seting for pascal, overrides personal "ftdetect" setting.

Gary Johnson

unread,
Nov 17, 2020, 12:53:58 AM11/17/20
to reply+ACY5DGGVQYAWMXDUBY...@reply.github.com, vim...@googlegroups.com
On 2020-11-16, Anthony Thyssen wrote:
> @dkearns No sorry I am not using vim-puppet. It is not part of the normal
> vim-enhanced distribution.
>
> However having a look...
> I did have a personal files "vim/ftdetect/puppet.vim" with
>
> au BufRead,BufNewFile *.pp setf puppet
>
> in it. This obviously what was being used previously before the system
> "filetype.vim" file overrode it for "pascal"
> I also have a personal file... "vim/syntax/puppet.vim" providing the
> appropriate syntax.
>
> So I suppose the problem boils down to that this new system "filetype.vim"
> seting for pascal, overrides personal "ftdetect" setting.

If you want your personal ftdetect file(s) to override the filetype
setting of the system filetype.vim file, then your personal ftdetect
file(s) should be using "set filetype", not "setfiletype". See
":help ftdetect.

Regards,
Gary

vim-dev ML

unread,
Nov 17, 2020, 12:54:17 AM11/17/20
to vim/vim, vim-dev ML, Your activity

Bram Moolenaar

unread,
Nov 18, 2020, 7:39:47 AM11/18/20
to vim/vim, vim-dev ML, Comment


Anthony Thyssen wrote:

> **Describe the bug**

> When editing puppet configuration files of type *.pp the syntax highlighting is now pascal, rather than puppet
>
> **To Reproduce**

> Detailed steps to reproduce the behavior:
>
> vim --clean file.pp
> :set filetype
>
> result output is `filetype=pascal`
>
> This happens regardless of if "file.pp" exists (and is a valid puppet configuration file) or not
>
> **Expected behavior**

> Based on the suffix or content the filetype (and this syntax highlighting) is set to puppet.
>
> **Screenshots**
>
> **Environment (please complete the following information):**
> - VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 29 2020 00:00:00)
> Included patches: 1-1770
> - OS: fedora 31
> - Terminal:xterm though not applicable.
>
>
> **Additional context**

>
> A search reviled that ANY file with a ".pp" suffix will now be though of as being "pascal"
> Line 1165 of the vim82 system file "filetype.vim"
> ```
> au BufNewFile,BufRead *.pas,*.pp setf pascal
> ```
> However NOT all files with this suffix are pascal!
>
> A check on the GIT blame, shows this ws added 2 months ago, by...
> patch 8.2.1725: not all Pascal files are recognized
> https://github.com/vim/vim/commit/44aaf5416e0121500dd52b7cab306d7618b4fe53

>
>
> Currently I am overriding this with a personal workaround...
> ```
> " the /usr/share/vim/vim82/filetype.vim file sets '.pp' as pascal!
> au BufNewFile,BufRead *.pp setf puppet
> ```
> Though previously this was not needed.

I see that *.pp is used both for puppet and pascal. Can't tell which
one is more popular.

We can inspect the first few lines to guess what the file type is. It
appears Puppet uses "# comment", and I don't think that is valid Pascal,
so that could be a first hint. Just like Pascal uses "(*", which is
probably invalid in Puppet. But Pascal also uses "{ comment", not sure
is that still valid in Puppet.

I would appreciate if someone who knows both Puppet and Pascal (in
various variants) can figure out the best rules.

--
Women are probably the main cause of free software starvation.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


You are receiving this because you commented.

Doug Kearns

unread,
Nov 18, 2020, 8:38:18 AM11/18/20
to vim/vim, vim-dev ML, Comment

@brammool You can consider it assigned to me if you like but I probably won't get to it until next week.


You are receiving this because you commented.

Doug Kearns

unread,
Jan 12, 2021, 11:40:42 PM1/12/21
to vim/vim, vim-dev ML, Comment

@antofthy Could you please see if a0122dc fixes this for your cases?


You are receiving this because you commented.

Anthony Thyssen

unread,
Jan 13, 2021, 1:23:01 AM1/13/21
to vim/vim, vim-dev ML, Comment

@dkearns Thanks...
I will have a look when vim updates in my package repository

fedora 33, currently providing vim 8.2.2146-2.fc33

IN the mean time I am force all *.pp files to be puppet using

au BufNewFile,BufRead *.pp            setf puppet

in my personal "filetype.vim" file.

Though I see the patch includes a new override, for your "vimrc" file ...

let  filetype_pp = "puppet"


You are receiving this because you commented.

Anthony Thyssen

unread,
Feb 9, 2021, 2:10:24 AM2/9/21
to vim/vim, vim-dev ML, Comment

Okay I just checked and vim had an update to 8.2.2465 which should include the above patch 8.2.2334.

No it still does not recognise the file has being a puppet configuration file, but still thinks it is pascal.

Adding the entry

let filetype_pp="puppet"

do not help either.

Re-enabling the "filetype.vim" file entry (see previous post), as I just don't have any pascal files.


You are receiving this because you commented.

Bram Moolenaar

unread,
Feb 9, 2021, 4:44:06 PM2/9/21
to vim...@googlegroups.com, Anthony Thyssen

Anthony Thyssen wrote:

> Okay I just checked and vim had an update to 8.2.2465 which should include the above patch 8.2.2334.
>
> No it still does not recognise the file has being a puppet configuration file, but still thinks it is pascal.
>
> Adding the entry
> ```vim
> let filetype_pp="puppet"
> ```
> do not help either.

That should work. Try this to see what happens:

10verbose edit file.pp

Does this mention the dist#ft#FTpp() function?

If I do this with an empty file it results in "puppet".

--
[clop clop]
ARTHUR: Old woman!
DENNIS: Man!
ARTHUR: Man, sorry. What knight lives in that castle over there?
DENNIS: I'm thirty seven.
ARTHUR: What?
DENNIS: I'm thirty seven -- I'm not old!
The Quest for the Holy Grail (Monty Python)
Reply all
Reply to author
Forward
0 new messages