How to install Poor Man’s TSQL Formatter to SQL Server Management Studio (SSMS) 20

Since the official Poor Man’s TSQL Formatter is not support the latest version SSMS v20 yet, it needs a little bit tweak to make it work:

Assuming that previous version (2014-2018) has been installed before

Download the PoorMansTSqlFormatterSSMSPackage.Setup.1.6.16.msi  from https://poorsql.com/

Create a folder named ‘Extensions‘ under ‘C:\Program Files (x86)\Microsoft SQL Server Management Studio 20\‘ (If you install SSMS somewhere else, please change this path accordingly), then create a text file with the following content and saved it with name: ‘PoorMansTSqlFormatterSSMSPackage.pkgdef’:

[$RootKey$\InstalledProducts\FormatterPackage]
@="#ProductName"
"PID"="1.6.16"
"ProductDetails"="#ProductDescription"
[$RootKey$\Packages\{247609b1-2692-47d6-972a-976544685f0e}]
@="FormatterPackage"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="PoorMansTSqlFormatterSSMSPackage.FormatterPackage"
"CodeBase"="C:\Program Files (x86)\PoorMansTSqlFormatterSSMSExtension\PoorMansTSqlFormatterSSMSPackage.dll"
[$RootKey$\AutoLoadPackages\{48ea4a80-f14e-4107-88fa-8d0016f30b9c}]
"{247609b1-2692-47d6-972a-976544685f0e}"=dword:00000000
[$RootKey$\Menus]
"{247609b1-2692-47d6-972a-976544685f0e}"=", Menus.ctmenu, 1"

How to setup your own keyboard shortcut to format the code?
The default pre-configured keyboard shortcut won’t work since it has been conflict to the operation: “Edit.FormatSelection” (you have to remove it if you want to bind with the default keyboard shortcut), however, I like to setup my own, navigate to Tools -> Options -> Keyboard -> Keyboard -> Search “Tools.FormatTSQLCode” and assigned your own keyboard shortcut(I like to bind it with “Ctrl+Shift+F, Ctrl+Shift+F” (Need to remove the “Ctrl+Shift+F” binding for “Query.ResultsToFile“).