Package: cfn-lsp-extra
Cfn Lsp ExtraAn experimental cloudformation language server (with support for SAM templates) built on top ofcfn-lintand theCloudformation user guide, aiming to provide hovering, completion, etc.  YAML and JSON are supported, though YAML has more features currently implemented (for example snippets) and will give a better experience.  Trust me.https://user-images.githubusercontent.com/17688577/176939586-df1d9ed8-5ec6-46d5-9f26-7222644047bd.mp4FeaturesMethodStatustextDocument/hoverDone for resources (in particular, required properties for a resource will be auto-expanded), resource properties, subproperties and!Refs.TODOintrinsic functions.textDocument/completionDone for resources, resource properties, subproperties, property values (for enums), refs, !GetAtts and intrinsic functions.TODOFn::GetAtt.textDocument/definitionDone for!Refs and!GetAtts.TODOmappings.textDocument/publishDiagnosticsDone throughcfnlint.Also checkout thechangelog.InstallationFirst install the executable,pipxis recommended, but you can usepipinstead if you like to live dangerously:pipxinstallcfn-lsp-extraOr get the bleeding edge from source:pipxinstallgit+https://github.com/laurencewarne/cfn-lsp-extra.git@$(gitls-remotegit@github.com:laurencewarne/cfn-lsp-extra.git|head-1|cut-f1)Updating:pipxupgradecfn-lsp-extraEmacsInstall thelsp-cfn.elpackage.NeovimMake sure you're running at least0.8, then add the following in~/.config/nvim/filetype.lua:vim.filetype.add{pattern={['.*']={priority=math.huge,function(path,bufnr)localline1=vim.filetype.getlines(bufnr,1)localline2=vim.filetype.getlines(bufnr,2)ifvim.filetype.matchregex(line1,[[^AWSTemplateFormatVersion]])orvim.filetype.matchregex(line1,[[AWS::Serverless-2016-10-31]])thenreturn'yaml.cloudformation'elseifvim.filetype.matchregex(line1,[[["']AWSTemplateFormatVersion]])orvim.filetype.matchregex(line2,[[["']AWSTemplateFormatVersion]])orvim.filetype.matchregex(line1,[[AWS::Serverless-2016-10-31]])orvim.filetype.matchregex(line2,[[AWS::Serverless-2016-10-31]])thenreturn'json.cloudformation'endend,},},}Then you can use one of:Neovim'sbuilt-in LSP client:require('lspconfig.configs').cfn_lsp={default_config={cmd={os.getenv("HOME")..'/.local/bin/cfn-lsp-extra'},filetypes={'yaml.cloudformation','json.cloudformation'},root_dir=function(fname)returnrequire('lspconfig').util.find_git_ancestor(fname)orvim.fn.getcwd()end,settings={documentFormatting=false,},},}require('lspconfig').cfn_lsp.setup{}LanguageClient-neovim:letg:LanguageClient_serverCommands={
    \'yaml.cloudformation': ['~/.local/bin/cfn-lsp-extra'],\'json.cloudformation': ['~/.local/bin/cfn-lsp-extra']
    \ }Patches documenting integration for other editors are very welcome!Developmentcfn-lsp-extrausesnoxfor virtualenv management andpoetryfor dependency management.  You can install both of them using:pipxinstallnox
pipxinstallpoetryAnd then run tests, linting, etc (switching3.9for whichever Python version):nox--sessiontests-3.9# unit testsnox--sessionintegration-tests-3.9# integration testsnox--sessionlint-3.9# flake8 lintsnox--sessionmypy-3.9# mypy checksAlternativesvscode-cfn-lintcfn-lintNote this is used bycfn-lsp-extraunder the hood to generatediagnostics.  One difference withcfn-lsp-extrais that diagnostics will be refreshed every time you make a change to the document, in other words you don't need to save the file.yamllsYou can useyamllsin conjunction with the Cloudformation schema athttps://www.schemastore.org/json/as an alternative.  For Emacs,lsp-modecan installyamllsfor you, from there you could do something like:(defunmy-yamlls-cloudformation-setup();; There's also one for serverless(lsp-yaml-set-buffer-schema"https://raw.githubusercontent.com/awslabs/goformation/master/schema/cloudformation.schema.json")(setq-locallsp-yaml-custom-tags["!And""!Base64""!Cidr""!Equals""!FindInMap sequence""!GetAZs""!GetAtt""!If""!ImportValue""!Join sequence""!Not""!Or""!Ref Scalar""!Ref""!Select""!Split""!Sub""!fn"]));; Using the mode defined by https://www.emacswiki.org/emacs/CfnLint(add-hook'cfn-yaml-mode-hook#'my-yamlls-cloudformation-setup)(add-hook'cfn-yaml-mode-hook#'lsp-deferred)This will give you completions (and some support for value completions?), though no hover documentation.