vim-patch:9.1.1821: filetype: Not all PKL files are recognized (#36008)

Problem:  filetype: Not all PKL files are recognized
Solution: Detect *.pcf as pkl filetype, detect using the pkl-lsp://
          protocol as pkl filetype, include PKL syntax script
          (Jan Claußen)

This adds basic syntax support for the new PKL language by Apple.

What works:
- Shebang support
- Comment support
- Integers (decimal, hex, octal and binary) support
- Floating point support including exponentials
- Basic datatype support
- Unicode escape delimiters
- Escape code support
- String interpolation
- Support up to five pounds for custom delimiters
- Folding of multi-line comments and blocks

What doesn't work:

  The language heavily uses parameterized type declarations, which can get
  very complex. It is very hard to highlight this properly. There is
  official Tree-sitter support for this. Since it is hard to pull this off
  in a vim syntax file, I opted for basic support of the data types.

References:
  https://github.com/apple/pkl-pantry

fixes: vim/vim#18271
closes: vim/vim#18274

67a8f2945e

Co-authored-by: Jan Claußen <jan.claussen10@web.de>
This commit is contained in:
zeertzjq
2025-10-04 06:01:16 +08:00
committed by GitHub
parent 8151fc59cf
commit 2c76a50e20
4 changed files with 176 additions and 3 deletions

View File

@@ -949,6 +949,7 @@ local extension = {
pmod = 'pike',
rcp = 'pilrc',
pkl = 'pkl',
pcf = 'pkl',
PL = detect.pl,
pli = 'pli',
pl1 = 'pli',
@@ -2683,6 +2684,7 @@ local pattern = {
['^pacman%.log'] = starsetf(function(path, _bufnr)
return vim.uv.fs_stat(path) and 'pacmanlog' or nil
end),
['^pkl%-lsp://'] = 'pkl',
['printcap'] = starsetf(function(_path, _bufnr)
return require('vim.filetype.detect').printcap('print')
end),