Python Embedded Asm Highlight


Treesitter is the best!

TL;DR

Place this in ~/.config/nvim/queries/python/injections.scm

LISP
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
; extends

;; higlight assignment of string as asm,
;; if it's right after comment containing "# asm"

(
  (comment) @marker
  .
  (expression_statement
    (assignment
      right: (string
        (string_content) @injection.content)))
  (#eq? @marker "# asm")
  (#set! injection.language "asm")
)

Result

Screenshot