Configuration¶
EmmyLua loads settings from .emmyrc.json
located in project’s root.
For settings that aren’t listed in project’s .emmyrc.json
, EmmyLua will search
for user-specific defaults.
See also
Full list of configuration values is available in the reference section.
Compatibility with LuaLs¶
If your project uses LuaLs, EmmyLua will be able to extract some settings
from .luarc.json
. However, .emmyrc.json
configuration format is more
feature-rich, and incompatible parts will be automatically ignored.
Project settings¶
Create an .emmyrc.json
in the root directory of your project. At the minimum,
you’ll want to configure Lua runtime version:
{
"runtime": {
"version": "Lua5.4"
}
}
To kick-start configuration process you can use this template. It contains all project-specific settings along with their default values:
A template for project-specific .emmyrc.json
{
"codeAction": {
"insertSpace": false
},
"completion": {
"autoRequireFunction": "require",
"autoRequireNamingConvention": "keep",
"autoRequireSeparator": "."
},
"diagnostics": {
"disable": [],
"enable": true,
"enables": [],
"globals": [],
"globalsRegex": [],
"severity": {}
},
"doc": {
"knownTags": [],
"privateName": [],
"rstDefaultRole": null,
"rstPrimaryDomain": null,
"syntax": "md"
},
"format": {
"externalTool": null,
"useDiff": false
},
"resource": {
"paths": []
},
"runtime": {
"classDefaultCall": {
"forceNonColon": false,
"forceReturnSelf": false,
"functionName": ""
},
"extensions": [],
"frameworkVersions": [],
"nonstandardSymbol": [],
"requireLikeFunction": [],
"requirePattern": [],
"version": "LuaLatest"
},
"strict": {
"arrayIndex": true,
"docBaseConstMatchBaseType": true,
"metaOverrideFileDefine": true,
"requirePath": false,
"typeCall": false
},
"workspace": {
"encoding": "utf-8",
"ignoreDir": [],
"ignoreGlobs": [],
"library": [],
"moduleMap": [],
"preloadFileSize": 0,
"workspaceRoots": []
}
}
Tip
Only add project-specific setting to your project’s .emmyrc.json
. For example,
it’s a good idea to set up Lua version
or naming convention for auto-required paths,
but overriding settings for inlay hints would serve
no purpose.
User settings¶
You can override default settings by creating an .emmyrc.json
in your home
or config directory.
See also
Full list of places where EmmyLua searches for configs is available in the reference section.
Additionally, some editors allow overriding project’s config values. See installation instructions for details.
To kick-start configuration process you can use this template. It contains all user-specific settings along with their default values:
A template for user-specific .emmyrc.json
{
"codeLens": {
"enable": true
},
"completion": {
"autoRequire": true,
"baseFunctionIncludesName": true,
"callSnippet": false,
"enable": true,
"postfix": "@"
},
"diagnostics": {
"diagnosticInterval": 500
},
"documentColor": {
"enable": true
},
"hint": {
"enable": true,
"enumParamHint": false,
"indexHint": true,
"localHint": true,
"metaCallHint": true,
"overrideHint": true,
"paramHint": true
},
"hover": {
"enable": true
},
"inlineValues": {
"enable": true
},
"references": {
"enable": true,
"fuzzySearch": true,
"shortStringSearch": false
},
"semanticTokens": {
"enable": true,
"renderDocumentationMarkup": true
},
"signature": {
"detailSignatureHelper": true
},
"workspace": {
"enableReindex": false,
"reindexDuration": 5000
}
}
Schema¶
To enable intelligent completion and validation for configuration files, you can add a schema reference to your configuration file:
{
"$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json"
}