ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: zfl4 on Dec 11, 2020, 09:22 PM

Title: IDE integration
Post by: zfl4 on Dec 11, 2020, 09:22 PM
I have just rediscovered computer craft, after my first attempt with it many years ago in a mod pack. I'm still not great at programming, but I have a lot better of an understanding now.

I've been able to set up an ide to run along side Minecraft (just by finding the lua files in the world directory) and it works just fine if I save everything. However, the frustration of the clunky terminal, is replaced with the a text editor that doesn't understand the apis I want to use.

So the question is this: how can I integrate the computer craft code so that when I type turtle, for example, the ide knows I'm saying access the turtle api table.
Title: IDE integration
Post by: SquidDev on Dec 11, 2020, 09:34 PM
There's no "universal" way to do it, as it'll vary from editor to editor. If you're using VS Code, there's an extension pack for ComputerCraft (https://marketplace.visualstudio.com/items?itemName=lemmmy.computercraft-extension-pack), which adds auto-complete for the built-in APIs.

Otherwise, you might be able to copy the rom directory of the mod into a local folder and try to get your IDE to index it.
Title: IDE integration
Post by: Lupus590 on Dec 11, 2020, 11:49 PM
Personally, I use and would recommend Visual Studio Code with this extension: https://marketplace.visualstudio.com/items?itemName=lemmmy.computercraft-extension-pack

It includes the Lua extension that SquidDev recommended plus another written for computercraft that tells it all about the APIs that you want.
Title: IDE integration
Post by: SquidDev on Dec 12, 2020, 08:19 AM
Quote from: Lupus590 on Dec 11, 2020, 11:49 PMPersonally, I use and would recommend Visual Studio Code with this extension: https://marketplace.visualstudio.com/items?itemName=lemmmy.computercraft-extension-pack
Ah woops, that's what I meant to copy, and then got distracted by the language server. Thanks!
Title: IDE integration
Post by: QuickMuffin8782 on Dec 13, 2020, 04:38 PM
Quote from: SquidDev on Dec 12, 2020, 08:19 AM
Quote from: Lupus590 on Dec 11, 2020, 11:49 PM
Quote from: zfl4 on Dec 11, 2020, 09:22 PMI have just rediscovered computer craft, after my first attempt with it many years ago in a mod pack. I'm still not great at programming, but I have a lot better of an understanding now.

I've been able to set up an ide to run along side Minecraft (just by finding the lua files in the world directory) and it works just fine if I save everything. However, the frustration of the clunky terminal, is replaced with the a text editor that doesn't understand the apis I want to use.

So the question is this: how can I integrate the computer craft code so that when I type turtle, for example, the ide knows I'm saying access the turtle api table.
Personally, I use and would recommend Visual Studio Code with this extension: https://marketplace.visualstudio.com/items?itemName=lemmmy.computercraft-extension-pack
Ah woops, that's what I meant to copy, and then got distracted by the language server. Thanks!

I'd suggest to also find a local ComputerCraft editor that can wrap in Lua 5.1 and detect any mistakes in your code. I use a editor that uses java. The link that Microsoft Visual Studio should help with the plugin. (can't access and I have to use a editor with java because my PC uses Windows Vista.)