Comprehensive guide to the powerful features of EmmyLua Analyzer Rust

- 🎯 Smart Completion
- 💡 Code Hints
- 🔍 Code Diagnostics
- 📊 Code Navigation
- 🔄 Refactoring
- 🎨 Code Formatting
- 🔗 Link Features
- ✨ Visual Enhancements
EmmyLua provides industry-leading intelligent code completion features, supporting not only basic function, variable, table field, and module completion, but also multiple innovative features.
|
|
|
|
| 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" |
- 🔧 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.
Intelligent mouse hover hint system that provides rich contextual information and code insights.
- 🔍 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
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.
Powerful static analysis system based on EmmyLua annotations, helping you discover potential issues during coding and maintain code quality.
|
File-level Disable ---@diagnostic disable: undefined-global
-- Disable undefined-global check in entire file |
Single-line Disable ---@diagnostic disable-next-line: undefined-global
-- Disable check only for next line |
Fine-tune diagnostic behavior through configuration files:
{
"diagnostics": {
"disable": ["undefined-global", "unused"],
"enable": [],
"severity": {
"undefined-global": "error",
"unused": "warning"
}
}
}Powerful code navigation system that allows you to quickly locate and browse code in large projects.
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
|
|
| Method | Operation | Description |
|---|---|---|
| ⌨️ Command | Go to Definition |
Standard LSP navigation |
| 👁️ Preview | Peek Definition |
Popup preview definition |
| 🖱️ Click | Ctrl + Left Click |
Quick navigation |
- 🔍 Find All References:
Find All References - 🖱️ Quick Find:
Ctrl + Left Click
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.
Safe and efficient code refactoring tools to help you optimize code structure without breaking code logic.
- Rename Shortcut:
F2 - Smart Detection: Automatically identify all related references
- Cross-file Support: Support multi-file synchronous renaming
| Feature | Description |
|---|---|
| 🔍 Scope Analysis | Precisely identify variable scope to avoid miss-renaming |
| 📁 Cross-file Detection | Detect renaming impact on module imports/exports |
| Proactively discover naming conflicts and provide suggestions | |
| 📋 Preview Feature | Preview all affected locations before renaming |
Professional code formatting system based on EmmyLuaCodeStyle.
|
|
- 🔧 Function Folding:
function ... end - 🔀 Control Flow Folding:
if,for,while, etc. - 📊 Table Folding: Large table structure 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.
Intelligently identify and handle various links in code to improve development efficiency.
EmmyLua intelligently analyzes color values in strings and provides visual preview
|
|
-- File paths automatically recognized as clickable links
local config_path = "./config/settings.lua"
local image_file = "./assets/images/logo.png"| Feature | Description | Example |
|---|---|---|
| 📂 File Opening | Click path to directly open file | "./utils/helper.lua" |
Multi-level visual enhancement features to make code clearer and more readable.
Advanced syntax highlighting system based on LSP semanticHighlighting standard
|
🔍 Token Analysis
|
🎨 Visual Distinction
|
Advanced code rendering features implemented through proprietary protocols:
local mutable_var = 10 -- Mutable variable: underlined
local const_value = 42 -- Constant: normal display- 📏 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
| 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() |
{
"inlayHints": {
"enable": true,
"paramHint": true,
"indexHint": true,
"localHint": false,
"overrideHint": true
}
}While editors provide basic highlighting, EmmyLua provides more precise highlighting support:
|
📍 Reference Highlighting
|
🏷️ Keyword Groups
|
Provide the same highlighting experience as VS Code for other editors, ensuring consistent development experience.