LSM Documentation

Introduction

The Code Query Engine allows you to select and manipulate code using various types of annotations and modifiers. This document explains the different annotation types and modifiers available.

Reference

Inline Annotation

Uses dashes to underline the code you want to select.

Block Annotation

Uses vertical lines to mark the beginning and end of a code block.

Point Annotation

Uses a caret (^) to specify an exact position in the code.

Maybe Modifier

Indicates that the selected code is optional. The query will match whether or not this code exists.

Any Modifier

Matches based on code structure rather than content. By default, all block annotations have this modifier.

Exact Modifier

Enforces strict content matching (opposite of 'any'). The code must match exactly as specified.

AnyKind Modifier

Matches any type of node in the abstract syntax tree, regardless of its structure or content.

ExactPosition Modifier

Requires the code to match the exact position in the source file, including whitespace and formatting.

StickPrevious/StickNext Modifiers

Ensures code elements are adjacent. StickPrevious requires the element to follow the previous match, while StickNext requires it to precede the next match.

Regex Modifier

Uses regular expressions to match code content. Allows for flexible pattern matching within code blocks. See syntax

AI Modifier

Specifies LLM-based code transformations. Use \ to escape brackets if needed. Allows for intelligent code modifications.