diff options
author | Niels Breuker <niels.breuker@hotmail.nl> | 2023-03-12 23:43:27 +0100 |
---|---|---|
committer | Niels Breuker <niels.breuker@hotmail.nl> | 2023-03-12 23:43:27 +0100 |
commit | 366a61bd99ca09029f36eddfc16b4824e24c4c11 (patch) | |
tree | 7aab2055692301512003f718965c6b0e4298a16f /Server/Plugins/APIDump | |
parent | Fixed global variables/functions in APIDump being part of API docs (diff) | |
download | cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.tar cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.tar.gz cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.tar.bz2 cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.tar.lz cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.tar.xz cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.tar.zst cuberite-366a61bd99ca09029f36eddfc16b4824e24c4c11.zip |
Diffstat (limited to '')
-rw-r--r-- | Server/Plugins/APIDump/APIDesc.lua | 4 | ||||
-rw-r--r-- | Server/Plugins/APIDump/SettingUpLuaLanguageServer.html | 42 | ||||
-rw-r--r-- | Server/Plugins/APIDump/Static/vscode_lua_addon.png | bin | 0 -> 72014 bytes | |||
-rw-r--r-- | Server/Plugins/APIDump/Static/vscode_lua_settings.png | bin | 0 -> 24284 bytes |
4 files changed, 46 insertions, 0 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index a5f967915..fcb741dab 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -19239,6 +19239,10 @@ end Title = "Setting up the ZeroBrane Studio Lua IDE", }, { + FileName = "SettingUpLuaLanguageServer.html", + Title = "Setting up Lua-Language-Server (VSCode/Emacs)" + }, + { FileName = "UsingChunkStays.html", Title = "Using ChunkStays", }, diff --git a/Server/Plugins/APIDump/SettingUpLuaLanguageServer.html b/Server/Plugins/APIDump/SettingUpLuaLanguageServer.html new file mode 100644 index 000000000..ffe79aed9 --- /dev/null +++ b/Server/Plugins/APIDump/SettingUpLuaLanguageServer.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> + +<html> + <head> + <title>Cuberite - Setting up the Lua-Language-Server (VSCode)</title> + <link rel="canonical" href="https://api.cuberite.org/SettingUpLuaLanguageServer.html"> + <link rel="stylesheet" type="text/css" href="main.css" /> + <link rel="stylesheet" type="text/css" href="prettify.css" /> + <script src="prettify.js"></script> + <script src="lang-lua.js"></script> + <meta charset="UTF-8"> + </head> + <body> + <div id="content"> + <h1>Setting up the Lua-Language-Server (VSCode)</h1> + <p>This article will explain how to configure an IDE that is able to use the <a href="https://github.com/LuaLS/lua-language-server">Lua-Language-Server</a>. This article will show how it's done using Visual Studio Code, but it should work with any IDE that supports language servers.</p> + + <h2>About Language Servers</h2> + + <p>IDE's in the past always implemented every programming language they supported on their own, it was baked in. Because of this everyone supported different features. With language servers this all changes. A single language server can be created with a community which can be shared across any number of IDE's which support the protocol. To learn more about language servers and IDE's that support them see <a href="https://langserver.org/">langserver.org</a></p> + + <h2>First-time setup</h2> + <p>Visual Studio Code doesn't support Lua by default. Instead it has a marketplace where extensions can be downloaded from. In this example we're going to use the Lua extension by Sumneko who also created the language server.</p> + + <img src="Static/vscode_lua_addon.png" /> + + <h3>Libraries</h3> + <p>The extension doesn't know the Cuberite API by default. The extension, or rather the language server, supports the inclusion of libraries. In order to generate the definitions required by the language server you have to activate the APIDump plugin in Cuberite which is included by default but not enabled. When the plugin is enabled the entire API can be exported by using the 'api' command in the console. Once this has completed there is a new folder next to the Cuberite executable called LLS.</p> + <p>In order to use these definition files you need to create a settings.json file in the plugin folder you're developing for. This file should be in a folder called '.vscode'. If it doesn't exist yet you have to create it yourself. There are two important settings to configure: + <ul> + <li><b>Lua.runtime.version</b> which has to be set to "Lua 5.1". Cuberite only supports Lua 5.1.</li> + <li><b>Lua.workspace.library</b> which is an array containing all libraries used in the project. In this case it needs to point to the newly generated definition files. If you're developing your plugin using the same Cuberite instance as where you generated the definitions using the APIDump plugin you can set this to "../../LLS/cuberite/library". If your definitions are on a different location you will have to point to it yourself. Absolute paths are also supported.</li> + </ul> + </p> + + <p>After configuring your settings.json file would something like this:</p> + <img src="Static/vscode_lua_settings.png" /> + + <p>After saving the settings.json file the IDE should recognize Cuberite's API.</p> + </div> + </body> +</html> diff --git a/Server/Plugins/APIDump/Static/vscode_lua_addon.png b/Server/Plugins/APIDump/Static/vscode_lua_addon.png Binary files differnew file mode 100644 index 000000000..109f220ce --- /dev/null +++ b/Server/Plugins/APIDump/Static/vscode_lua_addon.png diff --git a/Server/Plugins/APIDump/Static/vscode_lua_settings.png b/Server/Plugins/APIDump/Static/vscode_lua_settings.png Binary files differnew file mode 100644 index 000000000..aee427c1e --- /dev/null +++ b/Server/Plugins/APIDump/Static/vscode_lua_settings.png |