Overview
emmylua_ls is a high-performance Language Server Protocol implementation for Lua, providing intelligent code completion, diagnostics, and advanced language features to editors and IDEs.
Installation
Basic Usage
Command-Line Options
Communication Options
Communication method for the language server.Available values:
stdio- Standard input/output (default, recommended for editor integration)tcp- TCP socket connection (useful for remote debugging)
Example Usage
Example Usage
IP address to listen on. Only valid when using TCP communication mode.
Example Usage
Example Usage
Port number to listen on. Only valid when using TCP communication mode.
Example Usage
Example Usage
Logging Options
Set the logging verbosity level.Available values:
error- Only log errorswarn- Log warnings and errorsinfo- Log informational messages (default)debug- Verbose debug logging
Example Usage
Example Usage
Path to the log file directory. Use
none to disable file logging.Example Usage
Example Usage
Advanced Options
Path to the resources and logs directory. Use
none to prevent assets from being written to the file system.Example Usage
Example Usage
Whether to load the Lua standard library definitions.
Example Usage
Example Usage
Force a specific editor mode for client-specific optimizations.Available values:
vscode- Visual Studio Codeintellij- IntelliJ IDEA / JetBrains IDEsneovim- Neovim
Example Usage
Example Usage
Editor Integration
VS Code
Install the EmmyLua extension from the marketplace. The extension automatically starts the language server. Custom configuration in settings.json:Neovim
IntelliJ IDEA
Install the EmmyLua2 plugin from the JetBrains Marketplace.Other Editors
Any editor supporting LSP can useemmylua_ls. Configure your LSP client to execute:
Communication Modes
STDIO Mode (Default)
Best for: Direct editor integration The language server communicates via standard input/output streams. This is the default and recommended mode for most use cases.- Zero network configuration
- Process-isolated
- Automatic lifecycle management by editor
- Best performance for local development
TCP Mode
Best for: Remote development, debugging, and testing The language server listens on a TCP socket, allowing remote connections.- Network-based communication
- Can connect from remote machines
- Useful for debugging LSP protocol
- Requires manual process management
TCP Mode Example
TCP Mode Example
Logging Configuration
Log Levels
Log File Management
Troubleshooting
Enable Debug Logging
For investigating issues, enable debug logging:Check Server Status
When using TCP mode, verify the server is listening:Common Issues
Server not starting
Server not starting
Check permissions:Check port availability (TCP mode):
High memory usage
High memory usage
For large projects:
- Ensure
.emmyrc.jsonexcludes build directories - Add patterns to ignore in workspace configuration
- Consider using
--load-stdlib falseif not needed
Incomplete completions
Incomplete completions
Verify standard library is loaded:Check workspace configuration:
- Ensure
.emmyrc.jsonor.luarc.jsonexists - Verify file patterns include your source files
Advanced Configuration
Multiple Workspace Folders
The language server automatically handles multi-root workspaces through LSP protocol messages. Configure workspace folders in your editor.Custom Standard Library
To use a custom standard library definition:- Create
.emmyrc.jsonin your workspace - Disable built-in stdlib:
emmylua_ls --load-stdlib false - Add your custom definitions in the workspace
Performance Tuning
Exit Codes
0- Clean exit1- Configuration error2- Connection error (TCP mode)- Other non-zero - Unexpected error (check logs)
See Also
- emmylua_check - Static analysis tool
- emmylua_doc - Documentation generator
- Configuration Reference - Workspace configuration options
