Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hello-42/22e7d385b07f9fb1ff90d81ef800c015 to your computer and use it in GitHub Desktop.

Select an option

Save hello-42/22e7d385b07f9fb1ff90d81ef800c015 to your computer and use it in GitHub Desktop.
Steps for supporting Luau and Luau LSP for roblox-based development in Sublime Text and with Sublime Text's LSP package
  1. Install Package Control

    • You may need to run "Package Control: Update/Overwrite All Packages" in order to satisfy dependencies that may be missing but are required for both the Package Control and LSP packages
  2. Install the "LSP" package

  3. Download luau-lsp.exe from the luau-lsp repository's releases

    • Place the luau-lsp.exe binary into a directory of your choosing (mine is C:\Users\me\.bin)

    • For the sake of clarity, we're going to call this directory's nickname {dirName} and everywhere {dirName} shows up in our settings, you should replace it with the name you gave your directory. This behavior also applies to some files we'll be downloading in steps further on down.

    • Add that directory to your environment path variables so that Sublime Text can call out to and use luau-lsp.exe when it runs

  4. Download Roblox's documentation and global types that we need to provide to luau-lsp.exe

  5. Edit the LSP package's package settings

    • Preferences -> Package Settings -> LSP -> Settings
    • Edit LSP.sublime-settings to include support for luau-lsp manually like so:
// Settings in here override those in "LSP/LSP.sublime-settings"
{
	"clients": {
		"luau-lsp": {
			"enabled": true,
			"selector": "source.luau",

			"command": [
				"luau-lsp", "lsp",
				"--definitions=$home\\{dirName}\\{global-types}",
				"--documentation=$home\\{dirName}\\{api-docs}",
			],

			"initializationOptions": {
				"changeConfiguration": true
			},
		}
	}
}
  1. Add syntax support for Luau to Sublime Text

  2. Associate .luau files with the Luau syntax

    • Create or open any .luau file
    • View -> Syntax -> Open all with current extension as... -> Luau
  3. Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment