Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Configuration for working with Lua Language Server and Selene in ComputerCraft and ComputerCraft: Tweaked

License

Notifications You must be signed in to change notification settings

nvim-computercraft/ide-config

Repository files navigation

IDE configuration for CC: Tweaked

Warning

This method is deprecated in favor of using Lua Language Server packages; please see the primary maintainer's writeup for details on how to set this up.

This includes a standard library for use with Selene on CC: Tweaked, as well as globals definitions for the Lua Language Server.

Selene is an extensible Lua linter written in Rust, and Lua Language Server is the backend to the Lua plugin in VSCode (as well as being the de-facto language server for Lua in other editors and IDEs, such as Neovim and Emacs).

You might also be interested in StyLua, a Lua formatter written in Rust. Its configuration is not included here because formatting configurations are typically highly opinionated.

Screenshots

Neovim Neovim with the Dracula theme and the Lualine plugin. Neovim with the Dracula theme and Lualine plugin.

Do you have a screenshot of your editor with this configuration? Open an issue to get it added here!

Usage

New project

Press the "Use this template" button in the top right of the GitHub page. You probably want to replace the README.md and LICENSE files with your own.

The Justfile file is not strictly necessary for this configuration to work; it is merely for convinience.

When cloning, make sure to pass the --recurse-submodules flag. (If you forgot to do that, run git submodule sync.)

Existing project

Copy .gitmodules, .luarc.json, cc-tweaked.yaml, and selene.toml to the root of your project.

Update your submodules with git submodule sync.

Optionally, copy the provided Justfile to allow easily running Selene.

Adding additional libraries

You can add additional Lua LS libraries by:

  1. Adding the library's source repository as a submodule in .lua-ls-defitions/meta/3rd/<submodule-name>.
  2. Adding $SUBMODULE_LOCATION + /library to line 7 of .luarc.json's array.

See the wiki page for a list of all Lua LS libraries intended for ComputerCraft.

Design decisions

Any globals defined in cc-tweaked.yaml are set as read-only to prevent accidents. You probably don't want this if you're writing an operating system that replaces these globals.

Credits

  • @carsakiller for CC: Tweaked's Lua Language Server library.
  • @MasonGulu and @Autist69420 for becoming early users of this configuration set.
  • You, because you are awesome for reading that entire document.

About

Configuration for working with Lua Language Server and Selene in ComputerCraft and ComputerCraft: Tweaked

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages