Articles

Addons can be used to add additional content for the Lua Language Server by doing the following:

They can then be published to the addon manager using the LLS-Addons repository .

Note

Addons are a refresh of what were previously called "third-party libraries".

Built-In Addons

There are a number of addons that come with the language server that can be found in meta/3rd .

Deprecated

The built-in addons are going to be removed in a future version .

Installing Addons

Note

If you use Visual Studio Code, addons can easily be installed using the addon manager. The below are instructions for manually installing an addon.

Addons can be installed from anywhere, however, many popular addons can be found in the LLS-Addons repository, an official collection of community addons used by the addon manager. The intention with the repository is that each addon is its own sub-repository (submodule) so that they can be forked and downloaded easily.

While addons can be installed from anywhere, we are going to go through installing from LLS-Addons . Take a look through the addons/ directory and open up your desired addon. Clicking module will bring you to the repository where that addon lives. You can then download the zip for that addon and unzip it to some directory, any directory, on your computer (e.g. C:\Users\me\Documents\LuaAddons). You can place any future addons in this directory as well, just make sure they are contained within their own directory (see below). Then add the path to this parent directory to workspace.userThirdParty.

plaintext
📂 LuaAddons/
    ├── 📂 Addon1/
    │    ├── 📁 library/
    │    ├── 📜 config.json
    │    └── 📜 plugin.lua
    └── 📂 Addon2/
         ├── 📁 library/
         └── 📜 config.json

So in this case, your setting could look like this in your configuration file:

JSON
{
  "Lua.workspace.userThirdParty": ["C:\Users\me\Documents\LuaAddons"]
}

Enabling Addons

Addons often define some configuration values in their config.json file that are meant to be automatically applied, however, they can still be applied manually.

Note

Again, this can be easily done using the addon manager in Visual Studio Code instead.

Automatically Enabling

If the addon in question has been configured to allow automatic enabling and it has been placed in a directory specified in workspace.userThirdParty, you will be prompted to enable it once certain critera is met. The critera is defined by the addon in its config.json file - this could be, for example, using require on the library or naming a file a certain way.

Manually Enabling

If the addon contains a library/ directory, you will want to paste the full path to that directory in your workspace.library setting. This will enable the provided definition files.

If the config.json contains settings, you will have to manually copy them to your configuration file.

Addon Manager

The addon manager, which is currently only available in Visual Studio Code, allows you to browse and install addons from LLS-Addons . It manages downloading addons and applying modifications to your configuration file.

The addon manager can be opened from the command palette Ctrl + P by running the "Open Addon Manager" command (lua.addon_manager.open).

The addon manager is a webview (basically an iframe) that contains a Vue.js webapp .

If you have feedback on the addon manager, please leave it in the vscode-lua repository .

Note

The addon manager uses Git to retrieve addons, make sure you have access to GitHub if you receive failures to fetch.

Creating an Addon

To create an addon, you will want to first create a directory where all your files will live. If you intend to publish your addon to LLS-Addons , you will also want a remote repository where people can access it. Both GitHub and GitLab have been confirmed to work, although any service that provides Git cloning over HTTP should work.

Addon Anatomy

An addon that contains definitions should place them in a library/ directory. You can use the LuaLS/addon-template to get up and running a little bit quicker.

plaintext
📂 myAddon/
    ├── 📁 library/
    │    ├── 📜 http.lua
    │    └── 📜 error.lua
    ├── 📜 plugin.lua
    └── 📜 config.json

Definition Files

The definition files should live in the library/ directory and should start with a @meta annotation. They can use LuaCATS annotations just like any Lua code.

Plugins

A plugin can be included simply by placing it in the addon folder and naming it plugin.lua.

config.json

The config.json file is very important for addons and must be included. A schema for it can be found at LLS-Addons/schemas/addon.schema.json . You can also browse some of the addons in that repository to see how the config.json file can be used. The settings array can contain any settings for the language server, as well as any VS Code settings, if applicable.

JSON
{
    // Name of the addon
    "name": "My Awesome Addon",

    // Lua string patterns to look for in a workspace.
    // If detected, this addon will be recommended to enable
    "words": [ "require[%s%(\"']+MAA[%)\"']" ],

    // Lua string patterns to look for in filenames.
    // If detected, this addon will be recommended to enable
    "files": ["my-awesome-file.lua"],

    // List of settings to apply when this addon is enabled
    "settings": {
        "Lua.diagnostics.globals" : [
            "awesome"
        ]
    }
}

Last Modified:

Addons /wiki/addons/ Built-In Addons /wiki/addons/#built-in-addons Installing Addons /wiki/addons/#installing-addons Enabling Addons /wiki/addons/#enabling-addons Automatically Enabling /wiki/addons/#automatically-enabling Manually Enabling /wiki/addons/#manually-enabling Addon Manager /wiki/addons/#addon-manager Creating an Addon /wiki/addons/#creating-an-addon Addon Anatomy /wiki/addons/#addon-anatomy Definition Files /wiki/addons/#definition-files Plugins /wiki/addons/#plugins config.json /wiki/addons/#configjson Annotations /wiki/annotations/ Annotation Formatting /wiki/annotations/#annotation-formatting Tips /wiki/annotations/#tips Documenting Types /wiki/annotations/#documenting-types Understanding This Page /wiki/annotations/#understanding-this-page Annotations List /wiki/annotations/#annotations-list @alias /wiki/annotations/#alias @as /wiki/annotations/#as @async /wiki/annotations/#async @cast /wiki/annotations/#cast @class /wiki/annotations/#class @deprecated /wiki/annotations/#deprecated @diagnostic /wiki/annotations/#diagnostic @enum /wiki/annotations/#enum @field /wiki/annotations/#field @generic /wiki/annotations/#generic @meta /wiki/annotations/#meta @module /wiki/annotations/#module @nodiscard /wiki/annotations/#nodiscard @operator /wiki/annotations/#operator @overload /wiki/annotations/#overload @package /wiki/annotations/#package @param /wiki/annotations/#param @private /wiki/annotations/#private @protected /wiki/annotations/#protected @return /wiki/annotations/#return @see /wiki/annotations/#see @source /wiki/annotations/#source @type /wiki/annotations/#type @vararg /wiki/annotations/#vararg @version /wiki/annotations/#version Build /wiki/build/ Configuration /wiki/configuration/ Configuration File /wiki/configuration/#configuration-file Client Configuration /wiki/configuration/#client-configuration Visual Studio Code /wiki/configuration/#visual-studio-code Neovim /wiki/configuration/#neovim Using built-in LSP client /wiki/configuration/#using-built-in-lsp-client Using coc.nvim /wiki/configuration/#using-cocnvim Kakoune /wiki/configuration/#kakoune Using kak-lsp /wiki/configuration/#using-kak-lsp luarc.json File /wiki/configuration/#luarcjson-file Custom Configuration File /wiki/configuration/#custom-configuration-file Definition Files /wiki/definition-files/ Creating Definition Files /wiki/definition-files/#creating-definition-files Using Definition Files /wiki/definition-files/#using-definition-files Developing /wiki/developing/ Debugging /wiki/developing/#debugging Quick Print /wiki/developing/#quick-print Append to Log File /wiki/developing/#append-to-log-file Attach Debugger /wiki/developing/#attach-debugger Multiple Workspace Support /wiki/developing/#multiple-workspace-support File Structure /wiki/developing/#file-structure Theming /wiki/developing/#theming Syntax Tokens /wiki/developing/#syntax-tokens Semantic Tokens /wiki/developing/#semantic-tokens Diagnosis Report /wiki/diagnosis-report/ Create a Report /wiki/diagnosis-report/#create-a-report How it Works /wiki/diagnosis-report/#how-it-works Diagnostics /wiki/diagnostics/ ambiguity /wiki/diagnostics/#ambiguity ambiguity-1 /wiki/diagnostics/#ambiguity-1 count-down-loop /wiki/diagnostics/#count-down-loop different-requires /wiki/diagnostics/#different-requires newfield-call /wiki/diagnostics/#newfield-call newline-call /wiki/diagnostics/#newline-call await /wiki/diagnostics/#await await-in-sync /wiki/diagnostics/#await-in-sync not-yieldable /wiki/diagnostics/#not-yieldable codestyle /wiki/diagnostics/#codestyle codestyle-check /wiki/diagnostics/#codestyle-check spell-check /wiki/diagnostics/#spell-check duplicate /wiki/diagnostics/#duplicate duplicate-index /wiki/diagnostics/#duplicate-index duplicate-set-field /wiki/diagnostics/#duplicate-set-field global /wiki/diagnostics/#global global-in-nil-env /wiki/diagnostics/#global-in-nil-env lowercase-global /wiki/diagnostics/#lowercase-global undefined-env-child /wiki/diagnostics/#undefined-env-child undefined-global /wiki/diagnostics/#undefined-global luadoc /wiki/diagnostics/#luadoc cast-type-mismatch /wiki/diagnostics/#cast-type-mismatch circle-doc-class /wiki/diagnostics/#circle-doc-class doc-field-no-class /wiki/diagnostics/#doc-field-no-class duplicate-doc-alias /wiki/diagnostics/#duplicate-doc-alias duplicate-doc-field /wiki/diagnostics/#duplicate-doc-field duplicate-doc-param /wiki/diagnostics/#duplicate-doc-param undefined-doc-class /wiki/diagnostics/#undefined-doc-class undefined-doc-name /wiki/diagnostics/#undefined-doc-name undefined-doc-param /wiki/diagnostics/#undefined-doc-param unknown-cast-variable /wiki/diagnostics/#unknown-cast-variable unknown-diag-code /wiki/diagnostics/#unknown-diag-code unknown-operator /wiki/diagnostics/#unknown-operator redefined /wiki/diagnostics/#redefined redefined-local /wiki/diagnostics/#redefined-local strict /wiki/diagnostics/#strict close-non-object /wiki/diagnostics/#close-non-object deprecated /wiki/diagnostics/#deprecated discard-returns /wiki/diagnostics/#discard-returns strong /wiki/diagnostics/#strong no-unknown /wiki/diagnostics/#no-unknown type-check /wiki/diagnostics/#type-check assign-type-mismatch /wiki/diagnostics/#assign-type-mismatch cast-local-type /wiki/diagnostics/#cast-local-type cast-type-mismatch /wiki/diagnostics/#cast-type-mismatch-1 inject-field /wiki/diagnostics/#inject-field need-check-nil /wiki/diagnostics/#need-check-nil param-type-mismatch /wiki/diagnostics/#param-type-mismatch return-type-mismatch /wiki/diagnostics/#return-type-mismatch undefined-field /wiki/diagnostics/#undefined-field unbalanced /wiki/diagnostics/#unbalanced missing-fields /wiki/diagnostics/#missing-fields missing-parameter /wiki/diagnostics/#missing-parameter missing-return /wiki/diagnostics/#missing-return missing-return-value /wiki/diagnostics/#missing-return-value redundant-parameter /wiki/diagnostics/#redundant-parameter redundant-return-value /wiki/diagnostics/#redundant-return-value redundant-value /wiki/diagnostics/#redundant-value unbalanced-assignments /wiki/diagnostics/#unbalanced-assignments unused /wiki/diagnostics/#unused code-after-break /wiki/diagnostics/#code-after-break empty-block /wiki/diagnostics/#empty-block redundant-return /wiki/diagnostics/#redundant-return trailing-space /wiki/diagnostics/#trailing-space unreachable-code /wiki/diagnostics/#unreachable-code unused-function /wiki/diagnostics/#unused-function unused-label /wiki/diagnostics/#unused-label unused-local /wiki/diagnostics/#unused-local unused-varag /wiki/diagnostics/#unused-varag Export Documentation /wiki/export-docs/ Example /wiki/export-docs/#example Instructions /wiki/export-docs/#instructions FAQ /wiki/faq/ Where can I find the log file? /wiki/faq/#where-can-i-find-the-log-file Why are there two workspaces/progress bars? /wiki/faq/#why-are-there-two-workspacesprogress-bars Why is the server scanning the wrong folder? /wiki/faq/#why-is-the-server-scanning-the-wrong-folder How can I improve startup speeds? /wiki/faq/#how-can-i-improve-startup-speeds Code Formatting /wiki/formatter/ Configuration /wiki/formatter/#configuration Default Configuration /wiki/formatter/#default-configuration Code Style Checking /wiki/formatter/#code-style-checking Performance /wiki/performance/ Background /wiki/performance/#background Results /wiki/performance/#results Conclusion /wiki/performance/#conclusion Plugins /wiki/plugins/ Introduction /wiki/plugins/#introduction Template /wiki/plugins/#template Setup /wiki/plugins/#setup Functions /wiki/plugins/#functions OnSetText /wiki/plugins/#onsettext OnTransformAst /wiki/plugins/#ontransformast VM.OnCompileFunctionParam /wiki/plugins/#vmoncompilefunctionparam ResolveRequire /wiki/plugins/#resolverequire Settings /wiki/settings/ addonManager /wiki/settings/#addonmanager addonManager.enable /wiki/settings/#addonmanagerenable completion /wiki/settings/#completion completion.autoRequire /wiki/settings/#completionautorequire completion.callSnippet /wiki/settings/#completioncallsnippet completion.displayContext /wiki/settings/#completiondisplaycontext completion.enable /wiki/settings/#completionenable completion.keywordSnippet /wiki/settings/#completionkeywordsnippet completion.postfix /wiki/settings/#completionpostfix completion.requireSeparator /wiki/settings/#completionrequireseparator completion.showParams /wiki/settings/#completionshowparams completion.showWord /wiki/settings/#completionshowword completion.workspaceWord /wiki/settings/#completionworkspaceword diagnostics /wiki/settings/#diagnostics diagnostics.disable /wiki/settings/#diagnosticsdisable diagnostics.disableScheme /wiki/settings/#diagnosticsdisablescheme diagnostics.enable /wiki/settings/#diagnosticsenable diagnostics.globals /wiki/settings/#diagnosticsglobals diagnostics.groupFileStatus /wiki/settings/#diagnosticsgroupfilestatus diagnostics.groupSeverity /wiki/settings/#diagnosticsgroupseverity diagnostics.ignoredFiles /wiki/settings/#diagnosticsignoredfiles diagnostics.libraryFiles /wiki/settings/#diagnosticslibraryfiles diagnostics.neededFileStatus /wiki/settings/#diagnosticsneededfilestatus diagnostics.severity /wiki/settings/#diagnosticsseverity diagnostics.unusedLocalExclude /wiki/settings/#diagnosticsunusedlocalexclude diagnostics.workspaceDelay /wiki/settings/#diagnosticsworkspacedelay diagnostics.workspaceEvent /wiki/settings/#diagnosticsworkspaceevent diagnostics.workspaceRate /wiki/settings/#diagnosticsworkspacerate doc /wiki/settings/#doc doc.packageName /wiki/settings/#docpackagename doc.privateName /wiki/settings/#docprivatename doc.protectedName /wiki/settings/#docprotectedname format /wiki/settings/#format format.defaultConfig /wiki/settings/#formatdefaultconfig format.enable /wiki/settings/#formatenable hint /wiki/settings/#hint hint.arrayIndex /wiki/settings/#hintarrayindex hint.await /wiki/settings/#hintawait hint.enable /wiki/settings/#hintenable hint.paramName /wiki/settings/#hintparamname hint.paramType /wiki/settings/#hintparamtype hint.semicolon /wiki/settings/#hintsemicolon hint.setType /wiki/settings/#hintsettype hover /wiki/settings/#hover hover.enable /wiki/settings/#hoverenable hover.enumsLimit /wiki/settings/#hoverenumslimit hover.expandAlias /wiki/settings/#hoverexpandalias hover.previewFields /wiki/settings/#hoverpreviewfields hover.viewNumber /wiki/settings/#hoverviewnumber hover.viewString /wiki/settings/#hoverviewstring hover.viewStringMax /wiki/settings/#hoverviewstringmax misc /wiki/settings/#misc misc.parameters /wiki/settings/#miscparameters misc.executablePath /wiki/settings/#miscexecutablepath runtime /wiki/settings/#runtime runtime.builtin /wiki/settings/#runtimebuiltin runtime.fileEncoding /wiki/settings/#runtimefileencoding runtime.meta /wiki/settings/#runtimemeta runtime.nonstandardSymbol /wiki/settings/#runtimenonstandardsymbol runtime.path /wiki/settings/#runtimepath runtime.pathStrict /wiki/settings/#runtimepathstrict runtime.plugin /wiki/settings/#runtimeplugin runtime.pluginArgs /wiki/settings/#runtimepluginargs runtime.special /wiki/settings/#runtimespecial runtime.unicodeName /wiki/settings/#runtimeunicodename runtime.version /wiki/settings/#runtimeversion semantic /wiki/settings/#semantic semantic.annotation /wiki/settings/#semanticannotation semantic.enable /wiki/settings/#semanticenable semantic.keyword /wiki/settings/#semantickeyword semantic.variable /wiki/settings/#semanticvariable signatureHelp /wiki/settings/#signaturehelp signatureHelp.enable /wiki/settings/#signaturehelpenable spell /wiki/settings/#spell spell.dict /wiki/settings/#spelldict telemetry /wiki/settings/#telemetry telemetry.enable /wiki/settings/#telemetryenable type /wiki/settings/#type type.castNumberToInteger /wiki/settings/#typecastnumbertointeger type.weakNilCheck /wiki/settings/#typeweaknilcheck type.weakUnionCheck /wiki/settings/#typeweakunioncheck window /wiki/settings/#window window.progressBar /wiki/settings/#windowprogressbar window.statusBar /wiki/settings/#windowstatusbar workspace /wiki/settings/#workspace workspace.checkThirdParty /wiki/settings/#workspacecheckthirdparty workspace.ignoreDir /wiki/settings/#workspaceignoredir workspace.ignoreSubmodules /wiki/settings/#workspaceignoresubmodules workspace.library /wiki/settings/#workspacelibrary workspace.maxPreload /wiki/settings/#workspacemaxpreload workspace.preloadFileSize /wiki/settings/#workspacepreloadfilesize workspace.useGitIgnore /wiki/settings/#workspaceusegitignore workspace.userThirdParty /wiki/settings/#workspaceuserthirdparty Syntax Errors /wiki/syntax-errors/ List of all syntax errors /wiki/syntax-errors/#list-of-all-syntax-errors action-after-return /wiki/syntax-errors/#action-after-return args-after-dots /wiki/syntax-errors/#args-after-dots block-after-else /wiki/syntax-errors/#block-after-else break-outside /wiki/syntax-errors/#break-outside err-assign-as-eq /wiki/syntax-errors/#err-assign-as-eq err-c-long-comment /wiki/syntax-errors/#err-c-long-comment err-comment-prefix /wiki/syntax-errors/#err-comment-prefix err-do-as-then /wiki/syntax-errors/#err-do-as-then err-eq-as-assign /wiki/syntax-errors/#err-eq-as-assign err-esc /wiki/syntax-errors/#err-esc err-nonstandard-symbol /wiki/syntax-errors/#err-nonstandard-symbol err-then-as-do /wiki/syntax-errors/#err-then-as-do exp-in-action /wiki/syntax-errors/#exp-in-action index-in-func-name /wiki/syntax-errors/#index-in-func-name jump-local-scope /wiki/syntax-errors/#jump-local-scope keyword /wiki/syntax-errors/#keyword local-limit /wiki/syntax-errors/#local-limit malformed-number /wiki/syntax-errors/#malformed-number miss-end /wiki/syntax-errors/#miss-end miss-esc-x /wiki/syntax-errors/#miss-esc-x miss-exp /wiki/syntax-errors/#miss-exp miss-exponent /wiki/syntax-errors/#miss-exponent miss-field /wiki/syntax-errors/#miss-field miss-loop-max /wiki/syntax-errors/#miss-loop-max miss-loop-min /wiki/syntax-errors/#miss-loop-min miss-method /wiki/syntax-errors/#miss-method miss-name /wiki/syntax-errors/#miss-name miss-sep-in-table /wiki/syntax-errors/#miss-sep-in-table miss-space-between /wiki/syntax-errors/#miss-space-between miss-symbol /wiki/syntax-errors/#miss-symbol set-const /wiki/syntax-errors/#set-const unexpect-dots /wiki/syntax-errors/#unexpect-dots unexpect-efunc-name /wiki/syntax-errors/#unexpect-efunc-name unexpect-lfunc-name /wiki/syntax-errors/#unexpect-lfunc-name unexpect-symbol /wiki/syntax-errors/#unexpect-symbol unicode-name /wiki/syntax-errors/#unicode-name unknown-attribute /wiki/syntax-errors/#unknown-attribute unknown-symbol /wiki/syntax-errors/#unknown-symbol Translations /wiki/translations/ Current Translations /wiki/translations/#current-translations Contributing /wiki/translations/#contributing Type Checking /wiki/type-checking/ Background /wiki/type-checking/#background How it Works /wiki/type-checking/#how-it-works Examples /wiki/type-checking/#examples Usage /wiki/usage/ Run /wiki/usage/#run Arguments /wiki/usage/#arguments entry /wiki/usage/#entry Flags /wiki/usage/#flags --doc /wiki/usage/#--doc --doc_out_path /wiki/usage/#--doc_out_path --logpath /wiki/usage/#--logpath --loglevel /wiki/usage/#--loglevel --metapath /wiki/usage/#--metapath --locale /wiki/usage/#--locale --configpath /wiki/usage/#--configpath --version /wiki/usage/#--version --check /wiki/usage/#--check --checklevel /wiki/usage/#--checklevel --force-accept-workspace /wiki/usage/#--force-accept-workspace --socket /wiki/usage/#--socket --develop /wiki/usage/#--develop Privacy /privacy/ Home / Install /#install GitHub Repository https://github.com/LuaLS/LuaLS.github.io Sponsor ❤️ https://github.com/LuaLS/lua-language-server/issues/484 Report Issue https://github.com/LuaLS/LuaLS.github.io/issues/ Contribute to Wiki https://github.com/LuaLS/LuaLS.github.io/blob/main/docs/CONTRIBUTING.md