Do you know if you can insert the current line number with yasnippet? I have two snippets that look almost identical to yours, although my non-pipe version leaves the cursor at the beginning of the label since I've found that I often want to customize the label because I may be inspecting similar variables at different points in the code.
Ah, figured it out. It's very powerful to be able to call elisp inside snippets. Here's my new Labeled Inspect snippet:
# -*- mode: snippet -*-
# name: Labeled Inspect
# key: lin
# --
IO.inspect($1, label: "$2$1 (`(buffer-name)`:`(line-number-at-pos))`")
and a piped version:
# -*- mode: snippet -*-
# name: Piped Inspect
# key: pin
# --
|> IO.inspect(label: "$2$1 (`(buffer-name)`:`(line-number-at-pos))`")