Editor Setup
EmmyLua Analyzer implements the Language Server Protocol (LSP), making it compatible with any editor that supports LSP. This guide covers setup for the most popular editors.Before proceeding, make sure you have installed the
emmylua_ls language server.Visual Studio Code
VS Code has the best out-of-box experience with EmmyLua Analyzer.Install the Extension
Install the EmmyLua extension from the VS Code Marketplace:Option 1: Using the GUI
- Open VS Code
- Click the Extensions icon (or press
Ctrl+Shift+X) - Search for “EmmyLua”
- Click Install on “EmmyLua” by tangzx
- Press
Ctrl+P(orCmd+Pon macOS) - Type:
ext install tangzx.emmylua - Press Enter
Configure the Extension
The extension will automatically detect
emmylua_ls in your PATH. If needed, you can specify a custom path:- Open VS Code Settings (
Ctrl+,orCmd+,) - Search for “EmmyLua”
- Set “EmmyLua: Language Server” to the path of your
emmylua_lsbinary
settings.json:VS Code Keybindings
Navigation
F12- Go to DefinitionShift+F12- Find All ReferencesCtrl+Shift+O- Go to SymbolCtrl+T- Go to Symbol in Workspace
Editing
F2- Rename SymbolCtrl+Space- Trigger CompletionCtrl+Shift+Space- Signature HelpCtrl+.- Quick Fix
Troubleshooting VS Code
Extension not activating
Extension not activating
Check the Output panel:
- View → Output
- Select “EmmyLua” from dropdown
- Look for error messages
emmylua_lsnot in PATH- Multiple Lua extensions conflicting
- Workspace not trusted
Slow performance
Slow performance
For large projects, adjust these settings:
Neovim
Neovim has excellent LSP support built-in (0.5+) or via plugins.Neovim 0.10+ (Built-in LSP)
For Neovim 0.10 and later, setup is simple:Add to Your Config
Add to your That’s it! Neovim will automatically start
init.lua:emmylua_ls for Lua files.Neovim with nvim-lspconfig
For Neovim 0.5-0.9 or if you prefer explicit configuration:Recommended Neovim Plugins
Enhance your Lua development with these plugins:- Completion
- UI Enhancements
Neovim Configuration for Plugin Development
If you’re developing Neovim plugins:IntelliJ IDEA / WebStorm
JetBrains IDEs have plugin support for EmmyLua.Install the Plugin
- Open IntelliJ IDEA / WebStorm
- Go to
File → Settings → Plugins(orPreferences → Pluginson macOS) - Click “Marketplace” tab
- Search for “EmmyLua2”
- Click Install
- Restart the IDE
Configure the Plugin
After restart:
- Go to
File → Settings → Languages & Frameworks → Lua - Set “Language Server” to the path of your
emmylua_lsbinary - Set “Lua Version” to match your project
Emacs
Emacs users can use LSP via lsp-mode or eglot.Using lsp-mode
Using eglot
Sublime Text
Sublime Text 4 has LSP support via the LSP package.Install Package Control
If you haven’t already, install Package Control.
Install LSP Package
- Press
Ctrl+Shift+P(orCmd+Shift+P) - Type “Install Package”
- Search for “LSP”
- Install “LSP” package
Helix
Helix has built-in LSP support.Vim (with vim-lsp)
For classic Vim with LSP support:Project Configuration
Regardless of your editor, create a.emmyrc.json file in your project root for project-specific settings:
Common Workflows
Framework-Specific Setup
- LÖVE 2D
- OpenResty
- Neovim Plugin
Language Server Options
You can pass command-line options toemmylua_ls:
TCP Mode (for debugging)
Start the language server in TCP mode:localhost:5007.
Troubleshooting
Language server not found
Language server not found
Ensure If not found, add to PATH:
emmylua_ls is in your PATH:Features not working
Features not working
Check if the language server is running:
- Look for LSP status in your editor’s status bar
- Check editor logs for errors
- Try restarting the language server
Slow performance on large projects
Slow performance on large projects
Optimize your configuration:
Conflicting with other Lua extensions
Conflicting with other Lua extensions
Disable other Lua language servers:
- VS Code: Disable “Lua” extension if you have it
- Neovim: Ensure only one LSP client is attached
- Check editor logs for conflicts
Next Steps
Configuration Guide
Learn about all configuration options
Annotation Reference
Master EmmyLua annotations
CLI Tools
Use static analysis and doc generation
Examples
See real-world examples
