Skip to content

Latest commit

 

History

History
125 lines (101 loc) · 5.99 KB

.emmyrc.json_EN.md

File metadata and controls

125 lines (101 loc) · 5.99 KB

Configuration File

To create a .emmyrc.json file in the root directory of your workspace, which is used to configure some parameters of EmmyLuaAnalyzer.

The main configuration format is:

{
    "completion": {
        "autoRequire": true,
        "autoRequireFunction": "require",
        "autoRequireNamingConvention": "camelCase",
        "callSnippet": false,
        "postfix": "@"
    },
    "signature": {
        "detailSignatureHelper": false
    },
    "diagnostics": {
        "disable": [
        ],
        "globals": [],
        "globalsRegex": [],
        "severity": {
        },
        "enables": [
        ]
    },
    "hint": {
        "paramHint": true,
        "indexHint": true,
        "localHint": true,
        "overrideHint": true
    },
    "runtime": {
        "version": "Lua5.4",
        "requireLikeFunction": [],
        "frameworkVersions": [],
        "extensions": [],
        "requirePattern": []
    },
    "workspace": {
        "ignoreDir": [

        ],
        "ignoreGlobs": [
        ],
        "library": [],
        "workspaceRoots": [],
        "preloadFileSize": 1048576,
        "encoding": ""
    },
    "resource": {
        "paths": [
        ]
    },
    "codeLens": {
        "enable": true
    },
    "strict": {
        "requirePath": false,
        "typeCall": true
    }
}

completion

  • autoRequire: Whether to automatically complete the require statement, default is true.
  • autoRequireFunction: The function name used for automatically completing the require statement, default is require.
  • autoRequireNamingConvention: The naming convention used for automatically completing the require statement, default is camelCase, optional values are camelCase, snakeCase, pascalCase.
  • callSnippet: Whether to use code snippets for function call completion, default is false.
  • postfix: The postfix used for completion, default is @. However, setting this option is currently ineffective.

signature

  • detailSignatureHelper: Whether to display detailed function signature help, default is false.

diagnostics

  • disable: List of disabled diagnostic messages. If you need to disable some diagnostic messages in the workspace, you need to fill in the corresponding diagnostic IDs, for example: "undefined-global".
  • globals: List of global variables. Global variables in this list will not be diagnosed as undefined.
  • globalsRegex: List of regular expressions for global variables. Global variables that match the regular expressions will not be diagnosed as undefined.
  • severity: Severity of diagnostic messages, for example: "undefined-global": "warning", optional values are "error", "warning", "information", "hint".
  • enables: List of enabled diagnostic messages. Not all diagnostic messages of the language service are enabled by default. You can use this option to enable some diagnostic messages, for example: "undefined-field".

hint

  • paramHint: Whether to display parameter hints, default is true.
  • indexHint: Whether to display hints when indexing expressions span multiple lines, default is true.
  • localHint: Whether to display hints for local variables, default is true.
  • overrideHint: Whether to display hints for overrides, default is true.

runtime

  • version: Runtime version, default is Lua5.4, optional values are Lua5.1, Lua5.2, Lua5.3, Lua5.4, LuaJIT.
  • requireLikeFunction: List of functions similar to require, used to identify functions similar to require, for example: ["import"].
  • frameworkVersions: List of framework versions, used to identify framework versions, for example: ["love2d"]. Can be used in conjunction with the version tag in emmylua doc.
  • extensions: List of file extensions, used to identify file extensions, for example: [".lua", ".lua.txt"].
  • requirePattern: List of require patterns, this parameter is related to package.path and package.cpath in Lua, for example: ["?.lua", "?.lua.txt"]. It is not necessary to fill in by default, it will be automatically included, ["?.lua", "?/init.lua"].

workspace

Workspace configuration, most workspace configurations support both relative paths and absolute paths.

  • ignoreDir: List of ignored directories, used to ignore some directories, for example: ["build", "dist"].
  • ignoreGlobs: List of ignored files, used to ignore some files based on regular expressions, for example: ["*.log", "*.tmp"].
  • library: List of library directories, used to specify some library files, for example: ["/usr/local/lib"].
  • workspaceRoots: List of workspace root directories, used to specify the root directories of the workspace, for example: ["Assets/script/Lua"]. This feature is mainly used to make require work properly. If you need to open the parent directory of the lua main directory, you need to add the relative path of the currently opened directory to the lua main directory here.
  • preloadFileSize: Preloaded file size, default is 1048576 bytes, used to control the size of preloaded files.
  • encoding: File encoding, default is utf-8, used for reading files.

resource

  • paths: List of resource paths, used to specify the root directories of the resources that need to be loaded, for example: ["Assets/settings"]. Its default value is the currently opened workspace directory. EmmyLua supports file path completion in any string and file path jumping in any string. By configuring this directory, EmmyLua can know which directories are resource directories and provide completion and jumping correctly.

codeLens

  • enable: Whether to enable the CodeLens feature, default is true.

strict

  • requirePath: Whether to enable strict mode for require, default is true. In strict mode, require must start from the specified root directory, otherwise it cannot jump.
  • typeCall: Whether to enable strict mode for type calls, default is true. In strict mode, type calls must have manually written overloads, otherwise it will return unknown. In non-strict mode, type calls will return themselves.