Skip to main content

Introduction to EmmyLua Analyzer

EmmyLua Analyzer is a revolutionary Lua development toolset built with Rust, delivering 10x faster performance than traditional Lua language servers while providing comprehensive static analysis, intelligent code completion, and documentation generation capabilities.

What is EmmyLua Analyzer?

EmmyLua Analyzer is a complete ecosystem for Lua development consisting of three main components:

emmylua_ls

Language Server Protocol (LSP) implementation for editor integration

emmylua_check

Static analyzer for identifying code issues in CI/CD pipelines

emmylua_doc_cli

Documentation generator from EmmyLua annotations

Why Choose EmmyLua Analyzer?

Performance First

Built with Rust’s zero-cost abstractions, EmmyLua Analyzer delivers exceptional performance:
  • 10x faster than traditional Lua language servers
  • Memory-efficient analysis engine
  • Incremental compilation for instant feedback
  • Handles large codebases with ease

Intelligent Analysis

EmmyLua’s type inference system understands complex Lua patterns, tracking types through function calls, table operations, and control flow to provide accurate diagnostics and suggestions.
Navigate your codebase effortlessly with go-to-definition, find-references, and workspace symbol search that understands module dependencies and require patterns.
Catch bugs as you type with over 50 diagnostic rules covering syntax errors, type mismatches, undefined variables, unused code, and code style issues.

Universal Compatibility

EmmyLua Analyzer supports all major Lua versions and implementations, making it suitable for any Lua project.
Supported Lua Versions:
  • Lua 5.1 through 5.5
  • LuaJIT with performance optimizations
  • Cross-platform: Windows, macOS, and Linux
Editor Support:
  • VS Code (via extension)
  • Neovim (native LSP)
  • IntelliJ IDEA (via plugin)
  • Any LSP-compatible editor

Key Features

Language Server Protocol (LSP)

The emmylua_ls language server provides a complete LSP implementation with:

Code Intelligence

  • Auto-completion with context awareness
  • Hover information with type details
  • Signature help for function calls
  • Inlay hints for types and parameters

Code Navigation

  • Go to definition
  • Find all references
  • Go to implementation
  • Document and workspace symbols

Refactoring

  • Smart rename across files
  • Code actions for quick fixes
  • Organize imports
  • Extract to function

Code Quality

  • Real-time diagnostics
  • Code formatting
  • Semantic highlighting
  • Call hierarchy

Annotation System

EmmyLua Analyzer supports both EmmyLua and Luacats annotation styles:
---@class Player
---@field name string Player's name
---@field health number Current health points
---@field position Vector3 Position in world space
local Player = {}

---Create a new player instance
---@param name string
---@param startPos Vector3
---@return Player
function Player.new(name, startPos)
    return setmetatable({
        name = name,
        health = 100,
        position = startPos
    }, {__index = Player})
end

---Apply damage to the player
---@param amount number Damage amount
---@return boolean alive Whether player is still alive
function Player:takeDamage(amount)
    self.health = self.health - amount
    return self.health > 0
end
Annotations provide type safety, better IDE support, and serve as inline documentation for your code.

Static Analysis

The emmylua_check tool performs comprehensive static analysis:
  • Over 50 diagnostic rules
  • Configurable severity levels
  • CI/CD integration support
  • JSON and text output formats
  • Fast analysis for large codebases

Documentation Generation

The emmylua_doc_cli tool generates beautiful documentation:
  • Parses EmmyLua annotations automatically
  • Generates Markdown or JSON output
  • Customizable templates
  • Perfect for API documentation
  • GitHub Pages integration

Architecture Overview

The analyzer consists of several layers:
  1. Parser Layer: Fast, error-tolerant Lua parser built with Rowan (Red-Green tree)
  2. Semantic Layer: Symbol resolution, scope analysis, and module dependency tracking
  3. Type System: Advanced type inference with generics, union types, and type narrowing
  4. Service Layer: LSP implementation, diagnostics engine, and documentation generator

Performance Characteristics

Startup Time

Cold start: < 2 seconds for most projectsIncremental updates: < 100ms

Memory Usage

~50MB base + ~100MB per 10k LOCEfficient incremental compilation

Next Steps

Installation

Install EmmyLua Analyzer and its components

Quick Start

Get up and running in 5 minutes

Editor Setup

Configure your favorite editor

Configuration

Learn about configuration options

Community and Support

GitHub Repository

Star us on GitHub and contribute

Report Issues

Found a bug? Let us know!

Build docs developers (and LLMs) love