VS Code

Features
- Code completion for built-in Cyber Engine Tweaks, Dear ImGui and Cyberpunk 2077 types and functions (except sqlite) 
- Type resolving for - Game.GetScriptableSystemsContainer():Get("Type"),- NewObject("Type"), and- GetSingleton("Type")
- Contextual suggestions for default values and predefined sets 
Installation
CET typedef
- Download and extract the Cyber Engine Tweaks Lua Lib. - The lib files linked above is not the newest version. 
- You can join the Cyberpunk 2077 Modding Community discord server and then visit this message to download the newest version (CET 1.27 / Patch 2.01 Typedefs). 
- You can alos check the pinned messages in the #cet-lua-scripting channel for any future update. 
 
- Install the Lua by sumneko extension. 
- Locate settings.json in VS code - Ctrl + Shift + P 
- C: > Users > (yourname) > AppData > Roaming > Code > User > {} settings.json
 

- Add next settings to the - .vscode\settings.jsonor in the Settings GUI:- NOTE: ensure commas occur after every line 
 
     "Lua.runtime.version": "LuaJIT",
     "Lua.workspace.preloadFileSize": 15360,
     "Lua.workspace.library": [
         "c:\\path\\to\\cet-lua-lib",
     ], - On first use it takes a couple of minutes to parse and cache all definitions. Unfortunately there is no visual indication of this process. When it's done the code assistance will be more responsive. 
Dear ImGui typedef
To install the typedefs for Dear ImGui, you can manually download the files from GitHub repository Nats-ji/CET_ImGui_lua_type_defines and then follow the same installation process in CET typedef to install them in VSCode.
Annotations
Callback parameters
You can specify the type of the parameters with @param annotation. It's very handy for Observe and Override:
---@param request PerformFastTravelRequest
Observe("FastTravelSystem", "OnPerformFastTravelRequest", function(request)
    -- Now request object has type and suitable for code completion
end)
Unresolved type
If type of some variable cannot be resolved or ambiguous you can force the type with @type annotation:
---@type ScriptedPuppet
local puppetGeneric functions
The type of the result of some functions depends on the parameters passed to the function. If a valid type name is passed as a parameter, then the resulting type must be resolved without custom annotations.

Last updated