patch 9.1.1271: filetype: Power Query files are not recognized Commit: https://github.com/vim/vim/commit/e74ec3f523a152f62a37cc3ab476f0e5a2e812c6 Author: Anarion Dunedain <anario...@gmail.com> Date: Thu Apr 3 21:08:25 2025 +0200
patch 9.1.1271: filetype: Power Query files are not recognized Problem: filetype: Power Query files are not recognized Solution: detect '*.pq' as pq filetype, include pq syntax and filetype plugin (Anarion Dunedain) Microsoft Power Query provides a powerful data import experience that encompasses many features. Power Query works with desktop Analysis Services, Excel, and Power BI workbooks, in addition to many online services, such as Fabric, Power BI service, Power Apps, Microsoft 365 Customer Insights, and more. A core capability of Power Query is to filter and combine, that is, to mash-up data from one or more of a rich collection of supported data sources. Any such data mashup is expressed using the Power Query M formula language. The M language is a functional, case sensitive language similar to F#. Reference: - Power Query M formula language overview: https://learn.microsoft.com/en-us/powerquery-m/ closes: #17045 Signed-off-by: Anarion Dunedain <anario...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS index f233b3936..180b9e991 100644 --- a/.github/MAINTAINERS +++ b/.github/MAINTAINERS @@ -255,6 +255,7 @@ runtime/ftplugin/plsql.vim @lee-lindley runtime/ftplugin/pod.vim @petdance @dkearns runtime/ftplugin/poefilter.vim @ObserverOfTime runtime/ftplugin/postscr.vim @mrdubya +runtime/ftplugin/pq.vim @anarion80 runtime/ftplugin/prisma.vim @ribru17 runtime/ftplugin/proto.vim @Limero runtime/ftplugin/ps1.vim @heaths @@ -580,6 +581,7 @@ runtime/syntax/plsql.vim @lee-lindley runtime/syntax/pod.vim @petdance runtime/syntax/poefilter.vim @ObserverOfTime runtime/syntax/postscr.vim @mrdubya +runtime/syntax/pq.vim @anarion80 runtime/syntax/privoxy.vim @dkearns runtime/syntax/progress.vim @rdnlsmith runtime/syntax/prolog.vim @XVilka diff --git a/runtime/filetype.vim b/runtime/filetype.vim index e767305a3..59e6a810b 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1967,6 +1967,9 @@ au BufNewFile,BufRead *.ps1,*.psd1,*.psm1,*.pssc setf ps1 au BufNewFile,BufRead *.ps1xml setf ps1xml au BufNewFile,BufRead *.cdxml,*.psc1 setf xml +" Power Query M +au BufNewFile,BufRead *.pq setf pq + " Printcap and Termcap au BufNewFile,BufRead *printcap \ let b:ptcap_type = "print" | setf ptcap diff --git a/runtime/ftplugin/pq.vim b/runtime/ftplugin/pq.vim new file mode 100644 index 000000000..2ed2fa423 --- /dev/null +++ b/runtime/ftplugin/pq.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin +" Language: Power Query M +" Maintainer: Anarion Dunedain <anario...@gmail.com> +" Last Change: 2025 Apr 3 + +if exists('b:did_ftplugin') + finish +endif + +let b:did_ftplugin = 1 + +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// + +setlocal commentstring=//\ %s + +let b:undo_ftplugin = 'setl com< cms<' diff --git a/runtime/syntax/pq.vim b/runtime/syntax/pq.vim new file mode 100644 index 000000000..5778dbca4 --- /dev/null +++ b/runtime/syntax/pq.vim @@ -0,0 +1,337 @@ +" Vim syntax file +" Language: Power Query M +" Maintainer: Anarion Dunedain <anario...@gmail.com> +" Last Change: +" 2025 Apr 03 First version + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +let s:keepcpo = &cpo +set cpo&vim + +" There are Power Query functions with dot or hash in the name +setlocal iskeyword+=. +setlocal iskeyword+=# + +setlocal foldmethod=syntax +setlocal foldtext=getline(v:foldstart) + +" DAX is case sensitive +syn case match + +" Any Power Query identifier +syn match pqIdentifier "\<[a-zA-Z0-9$_#]*\>" + +" Fold on parenthesis +syn region pqParenthesisFold start="(" end=")" transparent fold + +" Power Query keywords +syn keyword pqKeyword section sections shared +syn region pqKeyword start="\<let\> -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1u0Q1o-00G1ej-7h%40256bit.org.