Skip to main content

Setting up VS Code

Method 1: EmmyLua

It is highly recommended to install the following extensions (Each will be explained below):

EmmyLua

EmmyLua is an extremely powerful Lua plugin. It provides us with intelligent code completion, type hints, error checking, type inference, and more.

EmmyLua supports more than just VSCode, so if you use another IDE/Editor, you can likely use EmmyLua there too (No guarantee on the other plugins listed above):

  • Neovim: vim.lsp.enable({"emmylua_ls"})
  • IntelliJ

EmmyLuaCodeStyle

EmmyLuaCodeStyle is a plugin that adds a formatter for Lua code. It is highly recommended to use this plugin to format your code to ensure that everything is nice and formatted correctly. If your code is not formatted correctly, chances are that we will make you fix it in your pull request.

Everything is already set up for you, so you don't need to do anything besides installing the plugin. Please don't change any settings for it unless it has been agreed upon by the rest of the team.

EmmyLuaCodeStyle also supports IntelliJ, so if you use IntelliJ, you can use EmmyLuaCodeStyle there too—Plugin Name: Intellij-EmmyLuaCodeStyle

GLuaSnippets

GLuaSnippets is basically just a plugin that downloads lua snippets scraped from the Garry's Mod wiki to add support for GLua in VSCode. it is HIGHLY recommended to use this plugin, If you dont the above dependencies might as well be useless.

Sumneko.Lua is another Lua plugin that provides similar features to EmmyLua. However, when using it with a project the size of Monolith, it gets very, very slow. It is highly recommended to use EmmyLua instead.

GLua Enhanced is another plugin for Garry's Mod Lua. It isn't as feature rich as EmmyLua, but it does provide some features that EmmyLua doesn't have due this plugin being specifically made for Garry's Mod.

In some cases, it can be useful to use GLua Enhanced alongside EmmyLua for these reasons:

  • Workspace Globals Scanning—This allows you to scan your workspace for globals and see where they are used.
  • Global Calls Optimizer—Helps optimize global calls. This can be useful when you are doing something performance heavy that is using lots of global calls
  • Bytecode Heatmap Generator—Generates a (very approximate) heatmap of how heavy some parts of your code are, and allows you to inspect what bytecode is being generated and where.

GLuaLint

An extremely basic linter for GLua. EmmyLua basically throws this plugin in the bin, I dont know why you would use this, but it's here if you want it.