Giter Club home page Giter Club logo

isaac-lua-api-vscode's Introduction

Binding of Isaac Lua API

A VSCode Extension to add support and autocomplete for the The Binding of Isaac: Repentance modding API to the Lua Language Server by Sumneko.

Open in VSCode Build Status Marketplace Version

This extension uses the Lua Language Server by Sumneko to add autocomplete for The Binding of Isaac: Repentance's modding API with EmmyLua annotations.

Tired of having to go to the docs every time you want to mod any small thing? Of having to run the whole game to find out if you made an error that would have been immediately visible in the editor in any other language? Or just want an autocomplete that isn't "here's every single function name I found in the mod folder"? Then this might help you.

This extension is based on the isaac-api-autocomplete-lua repository.

How to use

First off, the extension won't be active by default even if enabled for convenience (not having to manually disable-enable it in each workspace), but instead it will detect if your workspace matches an Isaac mod (contains a metadata.xml file and lua files), then will ask you for confirmation, once per workspace. It also works if metadata.xml etc are in subfolders. You can also manually enable or disable the mod with a palette command, even if you initially answered otherwise.

By default, with the extension global functions like Game(), Vector(x, y) and Isaac.xxx should already be recognized. To have it work for callback parameters, you'll need to add ---@param tags, like so:

---@param npc EntityNPC
---@param intParameter integer
---@param source EntityRef
local myCallbackFunction(_, npc, intParameter, source)

Autocomplete should work with the type specifications too, so it shouldn't be too annoying. You should also do this for any other function where you want the autocomplete to work on its params, also adding ---@return for return types.

You can also use ---@type for specific variables, more info on the annotation documentation. Example:

---@type ItemConfig_Item
local item = [etc.]

More examples:

Extension Settings

This extension has no settings; you can configure behavior in the Lua Language Server extension settings.

Known Issues

There are some issues on the Lua Language Server (which otherwise is very very good) side. They might be fixed when the language server is updated.

  • Vector multiplication/division doesn't support number-vector operators such as
local a = Vector(0,1)
local b = 2 * a

Release Notes

See CHANGELOG.md for full changes.

1.6.0

Repentogon support as an extension setting. Thanks to 4head and Sanio for writing the Lua docs for it!

1.5.0

Now automatically detects if the folder is an Isaac mod, and asks the user for confirmation. See the top of the README for info.

1.3.0

  • Use vscode-lua's 3.5.0 new features:

    • @operator: Vectors and other classes with custom operators should work, currently doesn't support number-vector operators such as
    local a = Vector(0,1)
    local b = 2 * a
    
    • @enum: Enums are now properly defined as enum types
  • Fix EntityPlayer:UseActiveItem overloading

  • Fix removing old versions of library

1.2.0

  • Settings are now applied locally to the project, without affecting the global settings of the Lua extension, will be configurable in the future on a per-project basis
  • Added "workspaceSettings" setting to disable changing base VSCode settings (ie anm2 to XML file associations)

1.1.0

  • Added enums to the autocomplete.

1.0.0

  • Initial release.

isaac-lua-api-vscode's People

Contributors

dpower12 avatar filloax avatar s0meengineer avatar sanio46 avatar syntax-sculptor avatar thicco-catto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.