.__ .__
_____ | | __ _______ _______ _|__| _____
/ \| | | | \__ \ / \ \/ / |/ \
| Y Y \ |_| | // __ \_ | | \ /| | Y Y \
|__|_| /____/____/(____ / /\ |___| /\_/ |__|__|_| /
\/ \/ \/ \/ \/
Neovim plugin for mLua language support - the scripting language for MapleStory Worlds.
This is a wrapper plugin for the original mLua extension by MapleStory Worlds team.
Visit the MapleStory Worlds mLua documentation for language details.
For more information, see the ./doc/mlua.nvim.txt file.
- 🔍 LSP Integration - Language server support with autocomplete, go-to-definition, hover, etc.
- 📂 Full Workspace Loading - VS Code-style workspace initialization with all files loaded at startup
- 👁️ ExecSpace Decorations - Virtual text showing Client/Server/Multicast execution context
- 📝 File Watching - Automatic notifications to LSP when files are created/deleted/modified
- 🌳 Tree-sitter Support - Syntax highlighting via Tree-sitter parser
- 📝 Syntax Highlighting - Fallback Vim syntax when Tree-sitter is unavailable
- 🔧 Filetype Detection - Automatic
.mluafile recognition
- Neovim >= 0.9.0
- Node.js (for running the language server)
- mLua LSP (you can automatically install it to
~/.local/share/nvim/mlua-lspby running:Mlua installcommand) - Optional: nvim-treesitter for Tree-sitter support
- Optional: nvim-cmp for enhanced autocompletion
- Optional: tree-sitter-mlua for Tree-sitter parser
Using lazy.nvim
Stable version (main branch):
{
"seokgukim/mlua.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter", -- optional, for Tree-sitter support
"hrsh7th/nvim-cmp", -- optional, for autocompletion
"hrsh7th/cmp-nvim-lsp", -- optional, for LSP completion source
},
ft = "mlua", -- lazy load on mlua filetype
config = function()
require("mlua").setup({
-- Your configuration here (see Configuration section)
})
end,
}For enhanced syntax highlighting with Tree-sitter, simply run:
:Mlua tsinstallThis command will automatically:
- Clone the tree-sitter-mlua repository
- Install npm dependencies
- Generate the parser
- Compile the parser for your system
- Set up highlight queries
Requirements:
- Git
- Node.js and npm
- C compiler (gcc or cland, cl.exe on Windows)
Note: Restart Neovim after installation to activate Tree-sitter highlighting.
Default configuration:
require("mlua").setup({
lsp = {
enabled = true,
cmd = nil, -- Auto-detected from LSP module
capabilities = nil, -- Will use nvim-cmp capabilities if available
on_attach = nil, -- Optional: your custom on_attach function
execspace_decorations = true, -- Enable ExecSpace virtual text (Client/Server/etc)
},
treesitter = {
enabled = true,
parser_path = vim.fn.expand("~/tree-sitter-mlua"), -- Path to tree-sitter-mlua repo
},
keymaps = {
-- Set to false to disable a specific keymap, or change the key
hover = "K",
definition = "gd",
references = "gr",
declaration = "gD",
implementation = "gi",
rename = "<leader>rn",
code_action = "<leader>ca",
format = "<leader>f",
toggle_inlay_hints = "<leader>h",
},
-- Or set keymaps = false to disable all default keymaps
deprecated_commands = true, -- Set to false to hide deprecated command aliases from completion
})The plugin now uses a VS Code-style approach:
- On project open: All
.mluafiles are loaded into the LSP server (like VS Code) - File watching: New/deleted/modified files notify the LSP automatically
- Entry files:
.map,.ui,.model,.collisiongroupsetfiles are monitored for changes - ExecSpace decorations: Virtual text shows method execution context (Client/Server/etc)
This provides complete workspace awareness from the start, matching VS Code's behavior.
require("mlua").setup({
lsp = {
on_attach = function(client, bufnr)
-- Your custom on_attach logic here
print("mLua LSP attached to buffer " .. bufnr)
end,
},
})require("mlua").setup({
treesitter = {
enabled = false, -- Use Vim syntax highlighting instead
},
})The plugin provides a unified :Mlua command with subcommands:
| Command | Description |
|---|---|
:Mlua install |
Install mLua language server |
:Mlua update |
Update mLua language server to latest version |
:Mlua version |
Check installed vs latest LSP version |
:Mlua uninstall |
Uninstall mLua language server |
:Mlua tsinstall |
Automatically install Tree-sitter parser (clone, build, setup) |
:Mlua restart |
Restart the language server |
:Mlua reload |
Reload all workspace files (re-index and re-load) |
:Mlua execspace |
Toggle ExecSpace decorations on/off |
:Mlua execspacerefresh |
Refresh ExecSpace decorations for all buffers |
| Command | Description |
|---|---|
:Mlua hover |
Show hover information |
:Mlua definition |
Go to definition |
:Mlua references |
Find references |
:Mlua declaration |
Go to declaration |
:Mlua implementation |
Go to implementation |
:Mlua rename |
Rename symbol |
:Mlua codeaction |
Code action |
:Mlua format |
Format document |
:Mlua inlayhints |
Toggle inlay hints |
The old command style is still supported but deprecated. A warning will be shown when using them:
| Old Command | New Command |
|---|---|
:MluaInstall |
:Mlua install |
:MluaUpdate |
:Mlua update |
:MluaCheckVersion |
:Mlua version |
:MluaUninstall |
:Mlua uninstall |
:MluaTSInstall |
:Mlua tsinstall |
:MluaRestart |
:Mlua restart |
:MluaReloadWorkspace |
:Mlua reload |
:MluaToggleExecSpace |
:Mlua execspace |
:MluaRefreshExecSpace |
:Mlua execspacerefresh |
:MluaHover |
:Mlua hover |
:MluaDefinition |
:Mlua definition |
:MluaReferences |
:Mlua references |
:MluaRename |
:Mlua rename |
:MluaFormat |
:Mlua format |
:MluaToggleInlayHints |
:Mlua inlayhints |
When the mLua LSP attaches to a buffer, these keybindings are automatically set:
| Key | Action | Description |
|---|---|---|
K |
vim.lsp.buf.hover |
Show hover information |
gd |
vim.lsp.buf.definition |
Go to definition |
gr |
vim.lsp.buf.references |
Find references |
gD |
vim.lsp.buf.declaration |
Go to declaration |
gi |
vim.lsp.buf.implementation |
Go to implementation |
<leader>rn |
vim.lsp.buf.rename |
Rename symbol |
<leader>ca |
vim.lsp.buf.code_action |
Code action |
<leader>f |
vim.lsp.buf.format |
Format document |
<leader>h |
Toggle inlay hints | Toggle inlay hints |
You can customize keybindings via the keymaps config:
require("mlua").setup({
keymaps = {
hover = "K", -- Keep default
definition = "gd", -- Keep default
references = "<leader>gr", -- Custom key
rename = false, -- Disable this keymap
-- ... other keys
},
})To disable all default keymaps:
require("mlua").setup({
keymaps = false,
})The VS Code-style approach loads all workspace files at startup:
- Full context: All files loaded initially, complete IntelliSense from start
- File watching: Changes detected automatically via Neovim autocmds
- Async loading: Files loaded in batches to avoid blocking UI
- Cached predefines: Predefines cached to disk for faster restarts
The plugin includes debug utilities accessible via :lua require('mlua.debug').
Example usage:
:lua require('mlua.debug').check_status()
:lua require('mlua.debug').show_logs()
:lua require('mlua.debug').show_capabilities()mlua.nvim/
├── ftdetect/ # Filetype detection for .mlua files
│ └── mlua.vim
├── ftplugin/ # Filetype-specific settings
│ └── mlua.vim
├── lua/
│ ├── mlua.lua # Main plugin module
│ └── mlua/
│ ├── lsp.lua # LSP client setup and commands
│ ├── document.lua # Document service (file watching, lifecycle notifications)
│ ├── execspace.lua # ExecSpace decorations (Client/Server virtual text)
│ ├── workspace.lua # Workspace file loading and indexing
│ ├── predefines.lua # Predefines loader with JSON compression
│ ├── entries.lua # Entry file parsing (.map, .ui, .model, etc.)
│ ├── debug.lua # Debug utilities
│ └── utils.lua # Utility functions (path handling, fuzzy matching, etc.)
├── queries/ # Tree-sitter queries
│ └── mlua/
│ └── highlights.scm
├── syntax/ # Vim syntax highlighting (fallback)
│ └── mlua.vim
└── plugin/
└── mlua.lua # Plugin initialization
- ✅
scriptdeclarations with inheritance - ✅
propertydeclarations (static/readonly) - ✅
methoddeclarations (static/override) - ✅
handlerevent handlers - ✅
constructordeclarations - ✅ Standard Lua syntax (functions, control flow, etc.)
- Autocompletion for mLua keywords and constructs
- Go to definition
- Hover documentation
- Rename refactoring
- Find references
- Code actions
- Document formatting
- Inlay hints
When you open a project, all .mlua files are loaded into the LSP server at startup.
This matches VS Code's behavior and provides complete IntelliSense from the start.
For very large projects, the initial load may take a moment, but you'll see a progress notification.
Since MapleStory Worlds is designed for Windows, I strongly recommend running Neovim on Windows natively, not in WSL. Running in WSL can cause significant I/O overhead and delays with the language server.
How do I know? BRUTE FORCE.
This is a personal project and not an official one from the MSW team.
Note: Debugging support has been removed from this plugin. The MSW debugger uses a binary protocol instead of standard JSON-RPC DAP, making it incompatible with nvim-dap. A separate custom debug plugin may be developed in the future.
Someday maybe...
Contributions are welcome! Please feel free to submit a Pull Request.
- tree-sitter-mlua - Tree-sitter parser for mLua
MIT License - see LICENSE file for details
- MapleStory Worlds team for creating mLua
- Neovim and Tree-sitter communities
