module

Hecr::LSP::Index

Workspace component index: contract directives in .hecr files and plain defs in .cr files.

Constants

DEF_LINE = /^\s*(?:private\s+|protected\s+)?def\s+(?:self\.)?([a-z_][a-zA-Z0-9_]*[?!]?)/
DIRECTIVE = /\A\s*(?:<%!--(?<doc>.*?)--%>\s*)?<%@\s*(?<head>def\s.*?)\s*%>/m
MAX_INDEX_FILE_SIZE = 1024 * 1024

Components live in ordinary source files; skip anything larger so a vendored bundle or generated data file named .cr/.hecr can't make every index rebuild read it into memory.

Instance methods

build(root : String) : Array(Component)
Source
lookup(components : Array(Component), name : String) : Array(Component)
Source
names(components : Array(Component)) : Set(String)
Source
names_in(text : String) : Set(String)

Defs declared in a (possibly unsaved) document — merged into the known-component set so fresh components don't warn before saving.

Source