← Editor intelligence

Rule reference

v0.19.0

Every rule the drenv language server applies, by feature. All of it is derived from the DragonRuby version your project runs — new engine, new intelligence, automatically.

The x.y.z+ tag on each rule is the drenv release it arrived in.

Completions

Sources are tried in order; the first that matches the receiver wins. Completions are generous — they may come from partial knowledge.

Engine module methods0.17.0+

A constant receiver parsed from the installed engine's Ruby source — Geometry. and Easing. — completes with the method's signature and doc.

args.* chain tree0.17.0+

The full tree derived from the engine's docs and runtime source: args, args.inputs (+ keyboard, mouse, controller_one–four), args.outputs, args.audio, args.events, args.grid, args.layout, args.geometry, args.gtk. args.state / args.cvars / args.pixel_arrays appear as args. members but hold runtime/user-defined data, so they expose no static sub-members.

Core methods on literal receivers0.17.0+

[1, 2]. → Array, "s". → String, {}. → Hash, 5. → Numeric, :s. → Symbol. Names come from a curated mruby baseline plus DragonRuby's own core-class extensions parsed from the engine (e.g. Array#map_2d).

Class-level variants0.17.0+

Constructor-style class methods documented in the engine — Array.filter_map, Array.new — complete on the bare class.

One-hop typed variables0.17.0+

A local typed by its assignment completes its class: enemies = [] → Array; @anim = Animation.new → the workspace class's methods (inherited through the superclass chain and included modules); @ivar assignments that all agree on one type; and a method receiver typed by its unique @return (camera.ui. → the ui method's return class). Inference stops after one hop.

Hash-literal keys0.17.3+

h = { hp: 100 } → h. completes hp — DragonRuby patches Hash so h.hp reads h[:hp]. Keys list before the Hash methods; string keys are skipped (not dot-accessible).

Included & extended modules0.19.0+

include M mixes M's instance methods into the class — reachable on instances and as bare calls on self; extend M adds them as the class's singleton methods. Ancestry follows the superclass chain and includes recursively, unioned across every file that reopens the class.

Scoped bare identifiers0.18.4+

A bare call (no receiver) completes only what Ruby could reach there: locals in scope, methods on self (the enclosing class, its superclass chain, and included modules) or defined at top level, and constants — not every method name in the workspace. A def's YARD doc rides the completion when the name is unambiguous.

Docs on hover

Resolution is ordered from most specific to least; the first match returns.

Engine API methods0.17.0+

Geometry.distance and the args.* members show the exact markdown docs.dragonruby.org serves, matched to your installed engine version.

Core / class methods0.17.0+

A method on a literal or typed core receiver ([1,2].each) shows the engine's Array#each doc.

Instance & class variables0.17.0+

@ivar / @@cvar show the class they belong to, and borrow the doc of a same-named attr_* in that class.

Parameters & locals0.17.0+

A parameter or local resolves to its method ("parameter of Class#method"); a parameter also shows its @param type and description from the method's doc block.

Bare constants (lexical lookup)0.17.4+

A bare constant resolves the way Ruby does — enclosing namespaces first, then top-level. Layout inside module Main sees Main::Layout / ::Layout, never an unrelated Conjuration::UI::Layout that merely shares the name.

Def-site & workspace defs0.17.0+

Hovering a definition pins its qualified name and doc. A reopened name collapses to one entry; a genuinely ambiguous call lists candidates instead of guessing.

YARD rendering0.17.0+

Comment blocks render as markdown: @param / @return / @yield / @yieldparam / @yieldreturn / @raise as typed sections, @note & @deprecated as callouts, @see and type references as links resolved namespace-relatively, @example as a fenced ruby block, unknown tags italicised, and RDoc +code+ as inline code.

Signature help

For engine methods with a parsed signature.

Active-parameter tracking0.17.0+

As you type arguments, the current parameter is highlighted — positional or keyword. Works on DragonRuby's paren-less call style, tracked from the syntax tree rather than counting commas.

Signature detail0.17.0+

Completions and hovers show the full signature, e.g. distance(point_one, point_two).

Diagnostics

Warnings fire only when the server owns the full surface — the receiver is an engine module and the arguments are statically known (a literal, or a one-hop literal variable). Performance hints are Information, never warnings. A squiggle means something is actually wrong.

Syntax errorsError0.17.0+

tree-sitter error and missing nodes.

Method validityWarning0.17.0+

An unknown method on a fully-owned receiver (Geometry, Easing) — names the engine version. Array etc. have core methods beyond the documented set, so they get completions but never validity warnings.

Positional arityWarning0.17.0+

Argument count outside the method's required..max range, quoting the signature. A trailing **opts splat and a collapsed trailing options-hash are handled.

Unknown keywordWarning0.17.0+

A keyword the method doesn't accept — lists the accepted keywords. Label (anchor_x:) and hash-rocket (:anchor_x =>) forms both normalise.

Missing required keywordWarning0.17.0+

A keyword parameter with no default that wasn't passed (suppressed when a **opts splat forwards keywords).

Duck-shape checkWarning0.17.0+

A hash-literal argument missing the geometric attributes the engine's own method body reads off that parameter (e.g. Geometry.distance reads .x/.y on both points). Extends to one-hop literal-hash variables; never to inferred or dispatched types.

Array manipulation during iterationInformation · array-manipulation0.17.0+

Mutating a collection (delete/push/<</…) inside its own .each block. Collect changes and apply them after the loop.

Array primitive to a render layerInformation · array-primitives0.17.0+

outputs.<layer> << [ … ] renders an Array primitive; a Hash is faster.

Per-iteration render appendInformation · bulk-concatenation0.17.0+

Appending to outputs.<layer> once per loop iteration — build an Array and concatenate once.

Direct recursionInformation · recursion0.17.0+

A method that calls itself — deep recursion risks exhausting mruby's stack at 60fps.

Discarded .mapInformation · unused-map0.17.0+

A block-form .map standing as a non-final statement whose result is thrown away — .each expresses the intent.

Tick-reachability gatingseverity modifier0.17.0+

Performance hints are softened from Information to Hint for methods provably invoked but never reachable from a tick (not hot per-frame). Methods on the tick call graph, or with no known callers, keep Information. Each links the engine's Troubleshoot Performance guide.

drenv.toml

Language service for the dependency manifest, from the CLI's schema.

Validation0.17.0+

Unknown keys, wrong value types, and malformed TOML surface as diagnostics (with best-effort positions), reusing the same schema drenv add / bundle enforce.

Completion0.17.0+

Section names ([package], [dependencies]) and keys (root, entrypoint, include, and dependency source specs) complete in context.

Principles behind the rules

  • Engine-derived. Methods, docs, signatures, shapes, and guide links come from the installed engine — never a curated list, with one documented exception (the plain-mruby core baseline, since the engine ships only patches against it).
  • Complete generously, warn conservatively. Completions may come from partial knowledge; a diagnostic requires owning the full surface and statically-known arguments.
  • Inference stops at one hop. A receiver is typed from a single assignment or a single @return; that result is never re-fed to type a further hop.
  • Dormant when irrelevant. Outside a DragonRuby project the server advertises no capabilities, so it's safe to enable for Ruby globally.