diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a5f9834 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +log/ +out/ +vscode-lua-*/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..96c3776 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Raoul Wols + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LSP-robloxluau.sublime-commands b/LSP-robloxluau.sublime-commands new file mode 100644 index 0000000..f04daf5 --- /dev/null +++ b/LSP-robloxluau.sublime-commands @@ -0,0 +1,10 @@ +[ + { + "caption": "Preferences: LSP-robloxluau Settings", + "command": "edit_settings", + "args": { + "base_file": "${packages}/LSP-robloxluau/LSP-robloxluau.sublime-settings", + "default": "// Settings in here override those in \"LSP-robloxluau/LSP-robloxluau.sublime-settings\"\n{\n\t$0\n}\n" + } + } +] diff --git a/LSP-robloxluau.sublime-settings b/LSP-robloxluau.sublime-settings new file mode 100644 index 0000000..a0bc95f --- /dev/null +++ b/LSP-robloxluau.sublime-settings @@ -0,0 +1,156 @@ +{ + // possible values: en-US, zh-CN + "locale": "en-US", + + // The startup command for this language server + "command": [ + "${storage_path}/LSP-robloxluau/bin/${binplatform}/lua-language-server", + "-E", + "-e", + "LANG=\"${locale}\"", + "${storage_path}/LSP-robloxluau/main.lua" + ], + + // The server version to download in $CACHE/Package Storage + "server_version": "1.3.0", + + // Disable the trigger characters, because there's too many of them. The + // default Lua syntax is capable enough to best decide when to trigger + // the auto-complete widget. + "disabled_capabilities": { + "completionProvider": { + "triggerCharacters": true + } + }, + + // We start this server when opening a lua file + "selector": "source.lua", + + // The server-specific settings + "settings": { + // Color mode. + // possible values: Grammar, Semantic + "Lua.color.mode": "Grammar", + // When the input looks like a file name, automatically `require` this file. + "Lua.completion.autoRequire": true, + // Shows function call snippets. + // possible values: Disable, Both, Replace + "Lua.completion.callSnippet": "Disable", + // Previewing the relevant code snippet of the suggestion may help you understand the usage + // of the suggestion. The number set indicates the number of intercepted lines in the code + // fragment. If it is set to `0`, this feature can be disabled. + "Lua.completion.displayContext": 6, + // Enable completion. + "Lua.completion.enable": true, + // Shows keyword syntax snippets. + // possible values: Disable, Both, Replace + "Lua.completion.keywordSnippet": "Replace", + // Display parameters in completion list. When the function has multiple definitions, they + // will be displayed separately. + "Lua.completion.showParams": true, + // Shows words within the workspace. + "Lua.completion.workspaceWord": true, + // Disabled diagnostic (Use code in hover brackets). + "Lua.diagnostics.disable": [], + // Enable diagnostics. + "Lua.diagnostics.enable": true, + // Defined global variables. + "Lua.diagnostics.globals": [], + // If you want to check only opened files, choice Opened; else choice Any. + "Lua.diagnostics.neededFileStatus": {}, + // Modified diagnostic severity. + "Lua.diagnostics.severity": {}, + // Latency (milliseconds) for workspace diagnostics. When you start the workspace, or edit + // any file, the entire workspace will be re-diagnosed in the background. Set to negative to + // disable workspace diagnostics. + "Lua.diagnostics.workspaceDelay": 0, + // Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also + // reduces the speed of workspace diagnostics. The diagnosis of the file you are currently + // editing is always done at full speed and is not affected by this setting. + "Lua.diagnostics.workspaceRate": 100, + // Enabel hint. + "Lua.hint.enable": false, + // Hint parameter name when the parameter called is literal. + "Lua.hint.paramName": true, + // Show type hints at the parameter of the function. + "Lua.hint.paramType": true, + // Hint type at assignment operation. + "Lua.hint.setType": false, + // Enable hover. + "Lua.hover.enable": true, + // When the value corresponds to multiple types, limit the number of types displaying. + "Lua.hover.enumsLimit": 5, + // When hovering to view a table, limits the maximum number of previews for fields. + "Lua.hover.previewFields": 20, + // Hover to view numeric content (only if literal is not decimal). + "Lua.hover.viewNumber": true, + // Hover to view the contents of a string (only if the literal contains an escape + // character). + "Lua.hover.viewString": true, + // The maximum length of a hover to view the contents of a string. + "Lua.hover.viewStringMax": 1000, + // Adjust the enabled state of the built-in library. You can disable (or redefine) the non- + // existent library according to the actual runtime environment. + // * `default`: Indicates that the library will be enabled or disabled according to the + // runtime version + // * `enable`: always enable + // * `disable`: always disable + "Lua.runtime.builtin": {}, + // File encoding. The `ansi` option is only available under the `Windows` platform. + // possible values: utf8, ansi + "Lua.runtime.fileEncoding": "utf8", + // Supports non-standard symbols. Make sure that your runtime environment supports these + // symbols. + "Lua.runtime.nonstandardSymbol": [], + // `package.path` + "Lua.runtime.path": [ + "?.lua", + "?/init.lua", + "?/?.lua" + ], + // Plugin path. Please read [wiki](https://github.com/sumneko/lua-language- + // server/wiki/Plugin) to learn more. + "Lua.runtime.plugin": "", + // The custom global variables are regarded as some special built-in variables, and the + // language server will provide special support + // The following example shows that 'include' is treated as' require '. + // ```json + // "Lua.runtime.special" : { + // "include" : "require" + // } + // ``` + "Lua.runtime.special": {}, + // Allows Unicode characters in name. + "Lua.runtime.unicodeName": false, + // Lua runtime version. + // possible values: Lua 5.1, Lua 5.2, Lua 5.3, Lua 5.4, LuaJIT + "Lua.runtime.version": "Lua 5.4", + // Enable signature help. + "Lua.signatureHelp.enable": true, + // Enable telemetry to send your editor information and error logs over the network. Read + // our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Privacy- + // Policy). + "Lua.telemetry.enable": false, + // Show progress bar in status bar. + "Lua.window.progressBar": true, + // Ignored files and directories (Use `.gitignore` grammar). + "Lua.workspace.ignoreDir": [ + ".vscode" + ], + // Ignore submodules. + "Lua.workspace.ignoreSubmodules": true, + // The directory path of the external function library. + // The language service will additionally load the lua files in these directories, even if + // they are not in the current workspace, for definition, completion and other features. + "Lua.workspace.library": [], + // Max preloaded files. + "Lua.workspace.maxPreload": 1000, + // Skip files larger than this value (KB) when preloading. + "Lua.workspace.preloadFileSize": 100, + // Ignore files list in `.gitignore` . + "Lua.workspace.useGitIgnore": true, + // Add private third-party library configuration file paths here, please refer to the built- + // in [configuration file path](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) + "Lua.workspace.userThirdParty": [], + } +} diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..9bfa8ae --- /dev/null +++ b/NOTICE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 最萌小汐 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..45e060b --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# LSP-robloxluau + +A language client for RobloxLuau. This package will download and unpack the robloxluau-language-server in `$DATA/Package Storage/LSP-robloxluau`. + +To use this package, you must have: + +- The [LSP](https://packagecontrol.io/packages/LSP) package. + +# Applicable Selectors + +This language server operates on files with the `source.lua` base scope. + +# Configuration + +Run `Preferences: LSP-robloxluau Settings` from the Command Palette. + +# Locale + +You can make this language server report documentation in English or Chinese. The default is English. To change it +into Chinese, run the command `Preferences: LSP-robloxluau Settings` and change the `"locale"` key. + +# Disabling Diagnostics via Code Actions + +This language server allows you to disable diagnostics by means of a Code Action. You can run the "Code Action" and the client (this package) is supposed to modify the settings to add or remove the unwanted diagnostic. This package implements that by editing your .sublime-project file. So in order for this to work, you need to have your window be backed by a .sublime-project file. [Learn more about projects here](https://www.sublimetext.com/docs/projects.html). \ No newline at end of file diff --git a/plugin.py b/plugin.py new file mode 100644 index 0000000..d5ea40d --- /dev/null +++ b/plugin.py @@ -0,0 +1,145 @@ +from LSP.plugin import AbstractPlugin +from LSP.plugin import register_plugin +from LSP.plugin import unregister_plugin +from LSP.plugin import DottedDict +from LSP.plugin.core.typing import Any, Callable, List, Dict, Mapping, Optional, Tuple +import sublime +import os +import urllib.request +import zipfile +import shutil +import tempfile + + +URL = "https://github.com/NightrainsRbx/RobloxLsp/releases/download/v{0}/robloxlsp-{0}.vsix" + + +class RobloxLuau(AbstractPlugin): + @classmethod + def name(cls) -> str: + return "LSP-{}".format(cls.__name__.lower()) + + @classmethod + def basedir(cls) -> str: + return os.path.join(cls.storage_path(), cls.name()) + + @classmethod + def version_file(cls) -> str: + return os.path.join(cls.basedir(), "VERSION") + + @classmethod + def zipfile(cls) -> str: + return os.path.join(cls.basedir(), "robloxlsp.vsix") + + @classmethod + def binplatform(cls) -> str: + return { + "linux": "Linux", + "windows": "Windows", + "osx": "macOS" + }[sublime.platform()] + + @classmethod + def bindir(cls) -> str: + return os.path.join(cls.basedir(), "bin", cls.binplatform()) + + @classmethod + def needs_update_or_installation(cls) -> bool: + settings, _ = cls.configuration() + server_version = str(settings.get("server_version")) + try: + with open(cls.version_file(), "r") as fp: + return server_version != fp.read().strip() + except OSError: + return True + + @classmethod + def install_or_update(cls) -> None: + shutil.rmtree(cls.basedir(), ignore_errors=True) + try: + settings, _ = cls.configuration() + server_version = str(settings.get("server_version")) + binplatform = cls.binplatform() + with tempfile.TemporaryDirectory() as tmp: + # Download the VSIX file + zip_file = os.path.join(tmp, "robloxlsp.vsix") + urllib.request.urlretrieve(URL.format(server_version), zip_file) + # VSIX files are just zipfiles + with zipfile.ZipFile(zip_file, "r") as z: + z.extractall(tmp) + for root, dirs, files in os.walk(os.path.join(tmp, "extension", "server", "bin")): + for d in dirs: + if d != binplatform: + shutil.rmtree(os.path.join(root, d)) + for root, dirs, files in os.walk(os.path.join(tmp, "extension", "server", "bin", binplatform)): + for file in files: + os.chmod(os.path.join(root, file), 0o744) + # Make sure package storage path exists for new users + os.makedirs(cls.storage_path(), exist_ok=True) + # Move the relevant subdirectory to the package storage + shutil.move(os.path.join(tmp, "extension", "server"), cls.basedir()) + # Write the version stamp + with open(cls.version_file(), "w") as fp: + fp.write(server_version) + except Exception: + shutil.rmtree(cls.basedir(), ignore_errors=True) + raise + + @classmethod + def configuration(cls) -> Tuple[sublime.Settings, str]: + base_name = "{}.sublime-settings".format(cls.name()) + file_path = "Packages/{}/{}".format(cls.name(), base_name) + return sublime.load_settings(base_name), file_path + + @classmethod + def additional_variables(cls) -> Optional[Dict[str, str]]: + settings, _ = cls.configuration() + return { + "binplatform": { + "linux": "Linux", + "windows": "Windows", + "osx": "macOS" + }[sublime.platform()], + "locale": str(settings.get("locale")) + } + + def on_pre_server_command(self, command: Mapping[str, Any], done_callback: Callable[[], None]) -> bool: + cmd = command["command"] + if cmd == "robloxluau.config": + return self._handle_robloxluau_config_command(command["arguments"], done_callback) + return super().on_pre_server_command(command, done_callback) + + def _handle_robloxluau_config_command(self, args: List[Dict[str, Any]], done_callback: Callable[[], None]) -> bool: + action = args[0]["action"] + if action == "add": + key = args[0]["key"] + value = args[0]["value"] + session = self.weaksession() + if not session: + return False + window = session.window + data = window.project_data() + if not isinstance(data, dict): + return False + dd = DottedDict(data) + key = "settings.LSP.LSP-robloxluau.settings.{}".format(key) + thelist = dd.get(key) + if isinstance(thelist, list): + if value not in thelist: + thelist.append(value) + else: + thelist = [value] + dd.set(key, thelist) + data = dd.get() + window.set_project_data(data) + done_callback() + return True + return False + + +def plugin_loaded() -> None: + register_plugin(RobloxLuau) + + +def plugin_unloaded() -> None: + unregister_plugin(RobloxLuau) diff --git a/sublime-package.json b/sublime-package.json new file mode 100644 index 0000000..a079b1d --- /dev/null +++ b/sublime-package.json @@ -0,0 +1,1232 @@ +{ + "contributions": { + "settings": [ + { + "file_patterns": [ + "/LSP-robloxluau.sublime-settings" + ], + "schema": { + "$id": "sublime://settings/LSP-robloxluau", + "allOf": [ + { + "$ref": "sublime://settings/LSP-plugin-base" + }, + { + "$ref": "sublime://settings/LSP-robloxluau#/definitions/PluginConfig" + } + ], + "definitions": { + "PluginConfig": { + "properties": { + "settings": { + "additionalProperties": false, + "properties": { + "Lua.color.mode": { + "default": "Semantic", + "enum": [ + "Grammar", + "Semantic" + ], + "markdownDescription": "Color mode.", + "markdownEnumDescriptions": [ + "Grammar color.", + "Semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect." + ], + "type": "string" + }, + "Lua.completion.autoRequire": { + "default": true, + "markdownDescription": "When the input looks like a file name, automatically `require` this file.", + "type": "boolean" + }, + "Lua.completion.callSnippet": { + "default": "Disable", + "enum": [ + "Disable", + "Both", + "Replace" + ], + "markdownDescription": "Shows function call snippets.", + "markdownEnumDescriptions": [ + "Only shows `function name`.", + "Shows `function name` and `call snippet`.", + "Only shows `call snippet.`" + ], + "type": "string" + }, + "Lua.completion.displayContext": { + "default": 6, + "markdownDescription": "Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled.", + "type": "integer" + }, + "Lua.completion.enable": { + "default": true, + "markdownDescription": "Enable completion.", + "type": "boolean" + }, + "Lua.completion.keywordSnippet": { + "default": "Replace", + "enum": [ + "Disable", + "Both", + "Replace" + ], + "markdownDescription": "Shows keyword syntax snippets.", + "markdownEnumDescriptions": [ + "Only shows `keyword`.", + "Shows `keyword` and `syntax snippet`.", + "Only shows `syntax snippet`." + ], + "type": "string" + }, + "Lua.completion.showParams": { + "default": true, + "markdownDescription": "Display parameters in completion list. When the function has multiple definitions, they will be displayed separately.", + "type": "boolean" + }, + "Lua.completion.workspaceWord": { + "default": true, + "markdownDescription": "Shows words within the workspace.", + "type": "boolean" + }, + "Lua.diagnostics.disable": { + "items": { + "type": "string" + }, + "markdownDescription": "Disabled diagnostic (Use code in hover brackets).\n", + "type": "array" + }, + "Lua.diagnostics.enable": { + "default": true, + "markdownDescription": "Enable diagnostics.", + "type": "boolean" + }, + "Lua.diagnostics.globals": { + "items": { + "type": "string" + }, + "markdownDescription": "Defined global variables.\n", + "type": "array" + }, + "Lua.diagnostics.neededFileStatus": { + "markdownDescription": "If you want to check only opened files, choice Opened; else choice Any.\n", + "properties": { + "ambiguity-1": { + "default": "Any", + "description": "%config.diagnostics.ambiguity-1%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "circle-doc-class": { + "default": "Any", + "description": "%config.diagnostics.circle-doc-class%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "close-non-object": { + "default": "Any", + "description": "%config.diagnostics.close-non-object%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "code-after-break": { + "default": "Opened", + "description": "%config.diagnostics.code-after-break%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "count-down-loop": { + "default": "Any", + "description": "%config.diagnostics.count-down-loop%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "deprecated": { + "default": "Opened", + "description": "%config.diagnostics.deprecated%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "doc-field-no-class": { + "default": "Any", + "description": "%config.diagnostics.doc-field-no-class%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "duplicate-doc-class": { + "default": "Any", + "description": "%config.diagnostics.duplicate-doc-class%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "duplicate-doc-field": { + "default": "Any", + "description": "%config.diagnostics.duplicate-doc-field%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "duplicate-doc-param": { + "default": "Any", + "description": "%config.diagnostics.duplicate-doc-param%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "duplicate-index": { + "default": "Any", + "description": "%config.diagnostics.duplicate-index%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "duplicate-set-field": { + "default": "Any", + "description": "%config.diagnostics.duplicate-set-field%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "empty-block": { + "default": "Opened", + "description": "%config.diagnostics.empty-block%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "global-in-nil-env": { + "default": "Any", + "description": "%config.diagnostics.global-in-nil-env%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "lowercase-global": { + "default": "Any", + "description": "%config.diagnostics.lowercase-global%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "newfield-call": { + "default": "Any", + "description": "%config.diagnostics.newfield-call%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "newline-call": { + "default": "Any", + "description": "%config.diagnostics.newline-call%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "no-implicit-any": { + "default": "None", + "description": "%config.diagnostics.no-implicit-any%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "redefined-local": { + "default": "Opened", + "description": "%config.diagnostics.redefined-local%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "redundant-parameter": { + "default": "Opened", + "description": "%config.diagnostics.redundant-parameter%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "redundant-value": { + "default": "Opened", + "description": "%config.diagnostics.redundant-value%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "trailing-space": { + "default": "Opened", + "description": "%config.diagnostics.trailing-space%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "unbalanced-assignments": { + "default": "Any", + "description": "%config.diagnostics.unbalanced-assignments%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "undefined-doc-class": { + "default": "Any", + "description": "%config.diagnostics.undefined-doc-class%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "undefined-doc-name": { + "default": "Any", + "description": "%config.diagnostics.undefined-doc-name%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "undefined-doc-param": { + "default": "Any", + "description": "%config.diagnostics.undefined-doc-param%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "undefined-env-child": { + "default": "Any", + "description": "%config.diagnostics.undefined-env-child%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "undefined-field": { + "default": "Opened", + "description": "%config.diagnostics.undefined-field%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "undefined-global": { + "default": "Any", + "description": "%config.diagnostics.undefined-global%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "unknown-diag-code": { + "default": "Any", + "description": "%config.diagnostics.unknown-diag-code%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "unused-function": { + "default": "Opened", + "description": "%config.diagnostics.unused-function%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "unused-label": { + "default": "Opened", + "description": "%config.diagnostics.unused-label%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "unused-local": { + "default": "Opened", + "description": "%config.diagnostics.unused-local%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + }, + "unused-vararg": { + "default": "Opened", + "description": "%config.diagnostics.unused-vararg%", + "enum": [ + "Any", + "Opened", + "None" + ], + "type": "string" + } + }, + "title": "neededFileStatus", + "type": "object" + }, + "Lua.diagnostics.severity": { + "markdownDescription": "Modified diagnostic severity.\n", + "properties": { + "ambiguity-1": { + "default": "Warning", + "description": "%config.diagnostics.ambiguity-1%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "circle-doc-class": { + "default": "Warning", + "description": "%config.diagnostics.circle-doc-class%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "close-non-object": { + "default": "Warning", + "description": "%config.diagnostics.close-non-object%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "code-after-break": { + "default": "Hint", + "description": "%config.diagnostics.code-after-break%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "count-down-loop": { + "default": "Warning", + "description": "%config.diagnostics.count-down-loop%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "deprecated": { + "default": "Warning", + "description": "%config.diagnostics.deprecated%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "doc-field-no-class": { + "default": "Warning", + "description": "%config.diagnostics.doc-field-no-class%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "duplicate-doc-class": { + "default": "Warning", + "description": "%config.diagnostics.duplicate-doc-class%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "duplicate-doc-field": { + "default": "Warning", + "description": "%config.diagnostics.duplicate-doc-field%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "duplicate-doc-param": { + "default": "Warning", + "description": "%config.diagnostics.duplicate-doc-param%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "duplicate-index": { + "default": "Warning", + "description": "%config.diagnostics.duplicate-index%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "duplicate-set-field": { + "default": "Warning", + "description": "%config.diagnostics.duplicate-set-field%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "empty-block": { + "default": "Hint", + "description": "%config.diagnostics.empty-block%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "global-in-nil-env": { + "default": "Warning", + "description": "%config.diagnostics.global-in-nil-env%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "lowercase-global": { + "default": "Information", + "description": "%config.diagnostics.lowercase-global%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "newfield-call": { + "default": "Warning", + "description": "%config.diagnostics.newfield-call%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "newline-call": { + "default": "Information", + "description": "%config.diagnostics.newline-call%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "no-implicit-any": { + "default": "Information", + "description": "%config.diagnostics.no-implicit-any%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "redefined-local": { + "default": "Hint", + "description": "%config.diagnostics.redefined-local%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "redundant-parameter": { + "default": "Hint", + "description": "%config.diagnostics.redundant-parameter%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "redundant-value": { + "default": "Hint", + "description": "%config.diagnostics.redundant-value%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "trailing-space": { + "default": "Hint", + "description": "%config.diagnostics.trailing-space%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "unbalanced-assignments": { + "default": "Warning", + "description": "%config.diagnostics.unbalanced-assignments%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "undefined-doc-class": { + "default": "Warning", + "description": "%config.diagnostics.undefined-doc-class%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "undefined-doc-name": { + "default": "Warning", + "description": "%config.diagnostics.undefined-doc-name%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "undefined-doc-param": { + "default": "Warning", + "description": "%config.diagnostics.undefined-doc-param%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "undefined-env-child": { + "default": "Information", + "description": "%config.diagnostics.undefined-env-child%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "undefined-field": { + "default": "Warning", + "description": "%config.diagnostics.undefined-field%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "undefined-global": { + "default": "Warning", + "description": "%config.diagnostics.undefined-global%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "unknown-diag-code": { + "default": "Waiting", + "description": "%config.diagnostics.unknown-diag-code%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "unused-function": { + "default": "Hint", + "description": "%config.diagnostics.unused-function%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "unused-label": { + "default": "Hint", + "description": "%config.diagnostics.unused-label%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "unused-local": { + "default": "Hint", + "description": "%config.diagnostics.unused-local%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + }, + "unused-vararg": { + "default": "Hint", + "description": "%config.diagnostics.unused-vararg%", + "enum": [ + "Error", + "Warning", + "Information", + "Hint" + ], + "type": "string" + } + }, + "title": "severity", + "type": "object" + }, + "Lua.diagnostics.workspaceDelay": { + "default": 0, + "markdownDescription": "Latency (milliseconds) for workspace diagnostics. When you start the workspace, or edit any file, the entire workspace will be re-diagnosed in the background. Set to negative to disable workspace diagnostics.", + "type": "integer" + }, + "Lua.diagnostics.workspaceRate": { + "default": 100, + "markdownDescription": "Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also reduces the speed of workspace diagnostics. The diagnosis of the file you are currently editing is always done at full speed and is not affected by this setting.", + "type": "integer" + }, + "Lua.hint.enable": { + "default": false, + "markdownDescription": "Enabel hint.", + "type": "boolean" + }, + "Lua.hint.paramName": { + "default": true, + "markdownDescription": "Hint parameter name when the parameter called is literal.", + "type": "boolean" + }, + "Lua.hint.paramType": { + "default": true, + "markdownDescription": "Show type hints at the parameter of the function.", + "type": "boolean" + }, + "Lua.hint.setType": { + "default": false, + "markdownDescription": "Hint type at assignment operation.", + "type": "boolean" + }, + "Lua.hover.enable": { + "default": true, + "markdownDescription": "Enable hover.", + "type": "boolean" + }, + "Lua.hover.enumsLimit": { + "default": 5, + "markdownDescription": "When the value corresponds to multiple types, limit the number of types displaying.", + "type": "integer" + }, + "Lua.hover.previewFields": { + "default": 20, + "markdownDescription": "When hovering to view a table, limits the maximum number of previews for fields.", + "type": "integer" + }, + "Lua.hover.viewNumber": { + "default": true, + "markdownDescription": "Hover to view numeric content (only if literal is not decimal).", + "type": "boolean" + }, + "Lua.hover.viewString": { + "default": true, + "markdownDescription": "Hover to view the contents of a string (only if the literal contains an escape character).", + "type": "boolean" + }, + "Lua.hover.viewStringMax": { + "default": 1000, + "markdownDescription": "The maximum length of a hover to view the contents of a string.", + "type": "integer" + }, + "Lua.runtime.builtin": { + "markdownDescription": "Adjust the enabled state of the built-in library. You can disable (or redefine) the non-existent library according to the actual runtime environment.\n\n* `default`: Indicates that the library will be enabled or disabled according to the runtime version\n* `enable`: always enable\n* `disable`: always disable\n", + "properties": { + "basic": { + "default": "default", + "description": "%config.runtime.builtin.basic%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "bit": { + "default": "default", + "description": "%config.runtime.builtin.bit%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "bit32": { + "default": "default", + "description": "%config.runtime.builtin.bit32%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "builtin": { + "default": "default", + "description": "%config.runtime.builtin.builtin%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "coroutine": { + "default": "default", + "description": "%config.runtime.builtin.coroutine%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "debug": { + "default": "default", + "description": "%config.runtime.builtin.debug%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "ffi": { + "default": "default", + "description": "%config.runtime.builtin.ffi%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "io": { + "default": "default", + "description": "%config.runtime.builtin.io%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "jit": { + "default": "default", + "description": "%config.runtime.builtin.jit%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "math": { + "default": "default", + "description": "%config.runtime.builtin.math%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "os": { + "default": "default", + "description": "%config.runtime.builtin.os%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "package": { + "default": "default", + "description": "%config.runtime.builtin.package%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "string": { + "default": "default", + "description": "%config.runtime.builtin.string%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "table": { + "default": "default", + "description": "%config.runtime.builtin.table%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + }, + "utf8": { + "default": "default", + "description": "%config.runtime.builtin.utf8%", + "enum": [ + "default", + "enable", + "disable" + ], + "type": "string" + } + }, + "type": "object" + }, + "Lua.runtime.fileEncoding": { + "default": "utf8", + "enum": [ + "utf8", + "ansi" + ], + "markdownDescription": "File encoding. The `ansi` option is only available under the `Windows` platform.", + "type": "string" + }, + "Lua.runtime.nonstandardSymbol": { + "items": { + "enum": [ + "//", + "/**/", + "`", + "+=", + "-=", + "*=", + "/=", + "||", + "&&", + "!", + "!=", + "continue" + ], + "type": "string" + }, + "markdownDescription": "Supports non-standard symbols. Make sure that your runtime environment supports these symbols.", + "type": "array" + }, + "Lua.runtime.path": { + "default": [ + "?.lua", + "?/init.lua", + "?/?.lua" + ], + "items": { + "type": "string" + }, + "markdownDescription": "`package.path`", + "type": "array" + }, + "Lua.runtime.plugin": { + "default": "", + "markdownDescription": "Plugin path. Please read [wiki](https://github.com/sumneko/lua-language-server/wiki/Plugin) to learn more.", + "type": "string" + }, + "Lua.runtime.special": { + "markdownDescription": "The custom global variables are regarded as some special built-in variables, and the language server will provide special support\nThe following example shows that 'include' is treated as' require '.\n```json\n\"Lua.runtime.special\" : {\n \"include\" : \"require\"\n}\n```\n", + "patternProperties": { + ".*": { + "default": "require", + "enum": [ + "_G", + "rawset", + "rawget", + "setmetatable", + "require", + "dofile", + "loadfile", + "pcall", + "xpcall" + ], + "scope": "resource", + "type": "string" + } + }, + "type": "object" + }, + "Lua.runtime.unicodeName": { + "default": false, + "markdownDescription": "Allows Unicode characters in name.", + "type": "boolean" + }, + "Lua.runtime.version": { + "default": "Lua 5.4", + "enum": [ + "Lua 5.1", + "Lua 5.2", + "Lua 5.3", + "Lua 5.4", + "LuaJIT" + ], + "markdownDescription": "Lua runtime version.", + "type": "string" + }, + "Lua.signatureHelp.enable": { + "default": true, + "markdownDescription": "Enable signature help.", + "type": "boolean" + }, + "Lua.telemetry.enable": { + "default": null, + "markdownDescription": "Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Privacy-Policy).\n", + "type": [ + "boolean", + "null" + ] + }, + "Lua.window.progressBar": { + "default": true, + "markdownDescription": "Show progress bar in status bar.", + "type": "boolean" + }, + "Lua.workspace.ignoreDir": { + "default": [ + ".vscode" + ], + "items": { + "type": "string" + }, + "markdownDescription": "Ignored files and directories (Use `.gitignore` grammar).\n", + "type": "array" + }, + "Lua.workspace.ignoreSubmodules": { + "default": true, + "markdownDescription": "Ignore submodules.", + "type": "boolean" + }, + "Lua.workspace.library": { + "items": { + "type": "string" + }, + "markdownDescription": "The directory path of the external function library.\nThe language service will additionally load the lua files in these directories, even if they are not in the current workspace, for definition, completion and other features.\n", + "type": "array" + }, + "Lua.workspace.maxPreload": { + "default": 1000, + "markdownDescription": "Max preloaded files.", + "type": "integer" + }, + "Lua.workspace.preloadFileSize": { + "default": 100, + "markdownDescription": "Skip files larger than this value (KB) when preloading.", + "type": "integer" + }, + "Lua.workspace.useGitIgnore": { + "default": true, + "markdownDescription": "Ignore files list in `.gitignore` .", + "type": "boolean" + }, + "Lua.workspace.userThirdParty": { + "items": { + "type": "string" + }, + "markdownDescription": "Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd)", + "type": "array" + } + } + } + } + } + } + } + }, + { + "file_patterns": [ + "/*.sublime-project" + ], + "schema": { + "properties": { + "settings": { + "properties": { + "LSP": { + "properties": { + "LSP-lua": { + "$ref": "sublime://settings/LSP-lua#/definitions/PluginConfig" + } + } + } + } + } + } + } + } + ] + } +}