From 366a61bd99ca09029f36eddfc16b4824e24c4c11 Mon Sep 17 00:00:00 2001 From: Niels Breuker Date: Sun, 12 Mar 2023 23:43:27 +0100 Subject: Added article explaining how to configure lua-language-server --- Server/Plugins/APIDump/APIDesc.lua | 4 ++ .../APIDump/SettingUpLuaLanguageServer.html | 42 +++++++++++++++++++++ Server/Plugins/APIDump/Static/vscode_lua_addon.png | Bin 0 -> 72014 bytes .../Plugins/APIDump/Static/vscode_lua_settings.png | Bin 0 -> 24284 bytes 4 files changed, 46 insertions(+) create mode 100644 Server/Plugins/APIDump/SettingUpLuaLanguageServer.html create mode 100644 Server/Plugins/APIDump/Static/vscode_lua_addon.png create mode 100644 Server/Plugins/APIDump/Static/vscode_lua_settings.png (limited to 'Server') 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 @@ -19238,6 +19238,10 @@ end FileName = "SettingUpZeroBrane.html", 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 @@ + + + + + Cuberite - Setting up the Lua-Language-Server (VSCode) + + + + + + + + +
+

Setting up the Lua-Language-Server (VSCode)

+

This article will explain how to configure an IDE that is able to use the Lua-Language-Server. This article will show how it's done using Visual Studio Code, but it should work with any IDE that supports language servers.

+ +

About Language Servers

+ +

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 langserver.org

+ +

First-time setup

+

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.

+ + + +

Libraries

+

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.

+

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: +

+

+ +

After configuring your settings.json file would something like this:

+ + +

After saving the settings.json file the IDE should recognize Cuberite's API.

+
+ + diff --git a/Server/Plugins/APIDump/Static/vscode_lua_addon.png b/Server/Plugins/APIDump/Static/vscode_lua_addon.png new file mode 100644 index 000000000..109f220ce Binary files /dev/null and b/Server/Plugins/APIDump/Static/vscode_lua_addon.png differ diff --git a/Server/Plugins/APIDump/Static/vscode_lua_settings.png b/Server/Plugins/APIDump/Static/vscode_lua_settings.png new file mode 100644 index 000000000..aee427c1e Binary files /dev/null and b/Server/Plugins/APIDump/Static/vscode_lua_settings.png differ -- cgit v1.2.3