I wrote a new ComputerCraft package for the text editor Sublime Text 2, which builds upon the current Lua one and includes colouring and code completions for all of the CC APIs. It also fixes the issue where the re-indent feature wouldn't work (it wouldn't code-fold at elseifs, or at functions defined in the way shown below), so you are able to use re-indent on screwed up code!
func = function(arg1, arg2, ...)
print(tostring(arg1) .. " " .. tostring(arg2) .. " " .. table.concat({...}, " "))
end
These functions will now be syntax-highlighted properly, and appear in the functions list when Go To Symbol (command/control+R) is selected
Features
- Syntax highlighting for every CC API function
- Syntax highlighting for every CC constant (keys.* and colours.*)
- Code completion for all main CC functions
- New default snippets relating to CC (clear screen, center print, BSoD template, proper checking if the computer is an advanced computer)
- Support for declaring functions 2 different ways (described above)
- Fixed the re-indent feature (Edit -> Line -> Reindent)
- Opening .lua files defaults to this syntax
- Multiline commenting using block comments (--[[ and ]]--)
- Fixed functions declared in the way shown above not re-indenting
Download
GitHub Repository: https://github.com/G...erCraft-Package
Installation
1. Download and install Sublime Text 2's Package Control Plugin
2. Open the command palette (Tools -> Command Palette, or Control+Shift+P / Command+Shift+P)
3. Search for Package Control: Install Packages
4. Search for ComputerCraft Package in the listings
5. Hit enter
6. Restart Sublime Text!
Installation for Linux in Sublime Text 3
- Open Sublime
- Click Preferences > Browse packages
- Copy path to this dir
- Open Terminal
- CD into that dir
- run git clone https://github.com/w...age_control.git "Package Control"
- CD into Package\ Control
- run git checkout python3
- Restart ST3
- Click Preferences > Package Control > Package Control: Install Package
- Choose ComputerCraft Package
- Wait fot it to download and install
- Done!
Credits
- NeverCast for the idea in his Sublime 2 Plugin for Auto-Lua Syntax (another very useful ST2 plugin)
- ChrisJay for the list of all CC functions used in the code completion
- TheOriginalBIT for tonnes of suggestions
Usage
To use it after you've installed it, just set the syntax to ComputerCraft (it should appear as an option once you've installed it). You can access the set syntax feature from the command palette (Tools -> Command Palette, or Shift+Control+P), and just look for Set Syntax: ComputerCraft. The syntax is also set as the default syntax for opening Lua files (.lua) when you install it.












