emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] New major-mode: bicep-ts-mode


From: Jostein Kjønigsen
Subject: [PATCH] New major-mode: bicep-ts-mode
Date: Thu, 21 Dec 2023 15:32:16 +0100

Hey everyone.

QUICK PREFACE

Currently if one works with Microsoft-oriented solutions (C#, .NET, TypeScript, Azure, etc) one often also has to work with Bicep. Bicep is a programming language used to describe Infrastructure-as-Code used for deploying services in Microsoft Azure cloud.

Unfortunately the only editor currently available with useful Bicep-support is Microsoft VSCode. Working with Bicep in Emacs currently is not really feasible.

The Bicep language itself is a type-safe language with an associated open-source toolchain, which in turn gets compiled to JSON-formatted Azure Resource Manager (ARM) templates, which can actually provision resources in Azure.

With appropriate editor-support, working with Bicep is superior to working with the untyped JSON for ARM template purposes. As such, adding support for Bicep to Emacs, would mean most Azure-developers can still stay 100% within Emacs to do their job :)

ABOUT THE PATCH

The attached patch tries to rectify the situation by making introducing tree-sitter based major-mode to handle important aspects of Bicep development:

* provide syntax highligting
* provide indentation
* provide imenu-support

The implementation itself depends on tree-sitter and the tree-sitter grammar developed by Amanda Qureshi (unaffiliated with this effort):
https://github.com/amaanq/tree-sitter-bicep

This grammar compiles and installs cleanly with the default settings found in M-x treesit-install-language-grammar given the repo URL only.

The implementation is fairly basic, but as far as I can see it works well and greatly improve the user-experience for Bicep-development.

NOT yet provided:

* adding Bicep.LangServer LSP-configuration to eglot (although I’ve tested that locally and it seems to work seamlessly once you have the Bicep language-server resolved).

The latter is essential into bringing Emacs to feature-parity with VSCode, but its probably best to land this major-mode, before committing to how that major-mode should be wired up inside Emacs :)


Any opinions?


For more information about Bicep, Microsoft has documentation online: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview?tabs=bicep
Bicep toolchain souce: https://github.com/Azure/bicep


Kind Regards
Jostein Kjønigsen

Attachment: bicep-ts-model.el
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]