Contents

Code map queries

The code map is Jacker’s index of a project’s symbols and how they connect. For a language pack’s language, it finds symbols with tree-sitter queries that you write against your grammar. This page lists the captures Jacker reads.

The queries follow the tags.scm convention many tree-sitter grammars already ship, so a grammar’s own queries/tags.scm is often a good start.

Files

In the language’s codemap:

grammar
The grammar, built for WebAssembly.
tags
Required. Definitions and calls.
imports
Optional. Imported paths.

Definitions

Capture a whole declaration as @definition.KIND and its name as @name, in the same pattern:

scheme
(function_declaration name: (identifier) @name) @definition.function
(class_declaration name: (identifier) @name) @definition.class

KIND is one of function, method, class, interface, module, namespace, type, enum, field, property, variable, constant, or macro. constant is stored as a variable, and macro as a function.

You don’t declare nesting. A definition belongs to the innermost definition whose source range contains it, or to the file. A method inside a class is therefore under that class.

A pattern without @name, and a kind not in the list, are ignored.

Calls

Capture a call as @reference.call, with the called name as @name:

scheme
(call_expression function: (identifier) @name) @reference.call

A call belongs to the innermost definition around it.

Imports

In the imports file, capture each imported path as @import.path. Surrounding quotes, backticks, or angle brackets are removed:

scheme
(import_declaration source: (string) @import.path)

Limits

  • Files larger than 1 MB aren’t indexed.
  • A file where more than a fifth of the tree is parse errors isn’t indexed.
  • Each query stops after 20,000 matches in one file.

When something is wrong

jacker-plugin validate checks that the grammar is a WebAssembly file and that the query files aren’t empty. It doesn’t compile the queries.

To check that they compile, load the plugin in developer mode (see Test a plugin in Jacker). A grammar that doesn’t load, or a query that names a node the grammar lacks, makes that language unavailable in the code map: Jacker’s log records “plugin language unavailable in the code map” with the error, and every other language keeps indexing.

We use only essential cookies to keep you signed in and the app working. With your consent we may enable optional analytics to help us improve e-volv. See our Privacy Policy and Terms.