๐ EmmyLua Language Server Features Guide
August 12, 2025 ยท View on GitHub
๐ EmmyLua Language Server Features Guide
Comprehensive guide to the powerful features of EmmyLua Analyzer Rust

๐ Table of Contents
- ๐ฏ Smart Completion
- ๐ก Code Hints
- ๐ Code Diagnostics
- ๐ Code Navigation
- ๐ Refactoring
- ๐จ Code Formatting
- ๐ Link Features
- โจ Visual Enhancements
๐ฏ Smart Completion
EmmyLua provides industry-leading intelligent code completion features, supporting not only basic function, variable, table field, and module completion, but also multiple innovative features.
๐ง Core Completion Features
๐ Auto Require
|
๐ท๏ธ Alias & Enum
|
โก Function Lambda
|
๐๏ธ Namespace
|
๐ฃ๏ธ Path Completion System
| Feature | Description | Example |
|---|---|---|
| ๐ Module Path | Smart completion for require parameters, supports . and / separators | require("utils.string") |
| ๐พ File System | Detects path strings, provides file system completion | "./config/settings.lua" |
๐ช Advanced Completion Features
- ๐ง Postfix: Type
@or.after variables to trigger expression completion - ๐ Snippet: Built-in code snippets, future support for custom template system
๐ก Tip: All completion features support fuzzy matching and smart sorting for a smoother coding experience.
๐ก Code Hints
Intelligent mouse hover hint system that provides rich contextual information and code insights.
โจ Basic Hint Features
- ๐ Variable Information: Type, scope, definition location
- โก Function Signatures: Parameter types, return values, documentation comments
- ๐ Table Fields: Field types, access permissions, inheritance relationships
- ๐ฆ Module Information: Export content, dependencies, version information
๐ Advanced Features
๐ข Constant Calculation
When variables are constant types, hover hints will display:
- โ Constant Values: Directly show the actual value of variables
- ๐งฎ Expression Calculation: Automatically calculate constant expression results
- ๐ Type Inference: Show precise types after calculation
local PI = 3.14159 -- Hover displays: const PI: number = 3.14159
local AREA = PI * 2 -- Hover displays: const AREA: number = 6.28318
๐ก Pro Tip: Constant calculation supports complex mathematical expressions and string operations, helping you better understand code logic.
๐ Code Diagnostics
Powerful static analysis system based on EmmyLua annotations, helping you discover potential issues during coding and maintain code quality.
โ๏ธ Diagnostic Control
๐ Comment Control
|
File-level Disable
|
Single-line Disable
|
โ๏ธ Configuration File Control
Fine-tune diagnostic behavior through configuration files:
{
"diagnostics": {
"disable": ["undefined-global", "unused"],
"enable": [],
"severity": {
"undefined-global": "error",
"unused": "warning"
}
}
}
๐ Code Navigation
Powerful code navigation system that allows you to quickly locate and browse code in large projects.
๐๏ธ Document Symbols
๐ Structured View
Access through multiple ways in VS Code:
- ๐ OUTLINE Panel: Structured view in left sidebar
- โจ๏ธ Shortcut:
Ctrl+Shift+Oto quickly open symbol list - ๐ Real-time Filtering: Type keywords to quickly locate symbols
๐ Workspace Symbol Search
๐ฏ Global Search
|
๐ Smart Features
|
๐ Code Navigation
๐ฏ Go to Definition
| Method | Operation | Description |
|---|---|---|
| โจ๏ธ Command | Go to Definition | Standard LSP navigation |
| ๐๏ธ Preview | Peek Definition | Popup preview definition |
| ๐ฑ๏ธ Click | Ctrl + Left Click | Quick navigation |
๐ Find References
๐ Standard Reference Finding
- ๐ Find All References:
Find All References - ๐ฑ๏ธ Quick Find:
Ctrl + Left Click
๐ Enhanced Reference Features
graph LR
A[String References] --> B[Exact Matching]
C[Fuzzy References] --> D[Smart Inference]
E[Configuration Control] --> F[Optional Enable]
- ๐ String References: Find usage locations of string literals
- ๐ฏ Fuzzy References: Smart matching for undefined variables
- โ๏ธ Configuration Control: Control enable status through configuration files
๐ก Tip: Reference finding supports cross-file analysis and can accurately identify dependencies between modules.
๐ Refactoring
Safe and efficient code refactoring tools to help you optimize code structure without breaking code logic.
๐ท๏ธ Rename Refactoring
โจ๏ธ Quick Operations
- Rename Shortcut:
F2 - Smart Detection: Automatically identify all related references
- Cross-file Support: Support multi-file synchronous renaming
๐ก๏ธ Safety Mechanisms
| Feature | Description |
|---|---|
| ๐ Scope Analysis | Precisely identify variable scope to avoid miss-renaming |
| ๐ Cross-file Detection | Detect renaming impact on module imports/exports |
| โ ๏ธ Conflict Detection | Proactively discover naming conflicts and provide suggestions |
| ๐ Preview Feature | Preview all affected locations before renaming |
๐จ Code Formatting
Professional code formatting system based on EmmyLuaCodeStyle.
โจ Formatting Features
๐ Document Formatting
|
๐ฏ Selection Formatting
|
๐ Code Folding
๐๏ธ Standard Folding
- ๐ง Function Folding:
function ... end - ๐ Control Flow Folding:
if,for,while, etc. - ๐ Table Folding: Large table structure folding
๐ฏ Custom Folding
--region Custom Folding Region
-- Code to be folded here
local config = {
-- Configuration items...
}
--endregion
๐ก Configuration Tip: For detailed formatting configuration options, please refer to EmmyLuaCodeStyle Documentation.
๐ Link Features
Intelligently identify and handle various links in code to improve development efficiency.
๐จ Color Preview
๐ Color Recognition
EmmyLua intelligently analyzes color values in strings and provides visual preview
๐ Supported Formats
|
โจ Visual Features
|
๐ Document Links
๐ Smart Path Recognition
-- File paths automatically recognized as clickable links
local config_path = "./config/settings.lua"
local image_file = "./assets/images/logo.png"
๐ Link Features
| Feature | Description | Example |
|---|---|---|
| ๐ File Opening | Click path to directly open file | "./utils/helper.lua" |
โจ Visual Enhancements
Multi-level visual enhancement features to make code clearer and more readable.
๐จ Semantic Highlighting
๐ Smart Syntax Coloring
Advanced syntax highlighting system based on LSP semanticHighlighting standard
๐ฏ Highlighting Features
|
๐ Token Analysis
|
๐จ Visual Distinction
|
๐๏ธ EmmyLua Enhanced Rendering
๐ฏ Private Protocol Enhancement
Advanced code rendering features implemented through proprietary protocols:
local mutable_var = 10 -- Mutable variable: underlined
local const_value = 42 -- Constant: normal display
โจ Enhancement Features
- ๐ Mutable Variable Underline: Automatically underline mutable local variables
- ๐จ Type Coloring: Smart coloring based on type system
- โก Real-time Updates: Real-time rendering updates when code is modified
๐ก Inlay Hints
๐ Smart Hint System
Display useful type and status information in code without mouse hovering
๐ง Hint Types
| Hint Type | Description | Example |
|---|---|---|
| ๐ท๏ธ Parameter Types | Show function parameter type information | function(name: string) |
| ๐ Variable Types | Show inferred variable types | local count: number |
| ๐ Override Markers | Mark overridden parent class methods | override function() |
| โก Async Calls | Mark await async calls | await coroutine() |
โ๏ธ Configuration Control
{
"inlayHints": {
"enable": true,
"paramHint": true,
"indexHint": true,
"localHint": false,
"overrideHint": true
}
}
๐ฏ Document Highlighting
๐ Smart Highlighting Features
While editors provide basic highlighting, EmmyLua provides more precise highlighting support:
|
๐ Reference Highlighting
|
๐ท๏ธ Keyword Groups
|
๐ Cross-Editor Support
Provide the same highlighting experience as VS Code for other editors, ensuring consistent development experience.