Language server for redscript.
For development setup and validation commands, see Contributing.
- error and warning diagnostics
- member autocompletion for methods, fields, and enum members, including REDmod array operations
- hover for functions and types, including specialized generic field types
- go-to-definition for types, functions, fields, local variables, and captured locals
- workspace symbols for types, functions, methods, and fields
- document symbols for outlines and breadcrumbs in both dialects
- quick fixes for supported community diagnostics
- completion snippets and Markdown documentation when supported by the client
- formatting for community (
.reds) and REDmod (.script) files
The server reads initializationOptions, which may set cache_file (a path to a
final.redscripts script cache) or game_dir (the Cyberpunk 2077 installation
root). cache_file takes precedence; game_dir looks for a cache under
r6/cache/modded/final.redscripts.bk, r6/cache/final.redscripts.bk, then
r6/cache/final.redscripts. When neither option is set, or the configured cache
is missing or cannot be loaded, the server falls back to a bundled base-game API
cache and warns that it may be out of date.
The server loads a TOML file named .redscript from every workspace folder. It
supports:
source_roots: source directories for both.redsand.scriptfiles, defaulting to["."].{ENV_VAR}references are expanded from the environment.format: community formatter settings (indent,max_width,max_chain_calls,max_chain_fields,max_chain_operators,max_chain_total). Whenformat.indentis unset, the server uses the tab size the client negotiates. These settings do not apply to REDmod files.
Example:
source_roots = [".", "../red4ext/plugins"]
[format]
indent = 2
max_width = 80The server supports community REDscript (.reds, exact extension) and REDmod
(.script, case-insensitive), selected by file extension. Both can share a
workspace and the same source_roots.
REDmod support is partial, not a replacement for the official compiler:
- Diagnostics, hover, go-to-definition, workspace symbols, and member completion work for the supported language subset.
- Array completions include operations such as
Size,PushBack, andLast. Completion tolerates a missing semicolon in the current statement; other syntax or unsupported-feature errors can prevent semantic features from working. - Formatting preserves source spelling and uses four-space indentation, ignoring community formatter settings. Invalid syntax is left unchanged.
Find references, rename, and keyword/local completion are not implemented for
either dialect. Quick-fix code actions and .redscript formatter settings apply
to community REDscript only.
Queries use unsaved changes from all open workspace files. Diagnostics update on
startup and save (including .redscript configuration saves), not on every
edit. Standalone files are analyzed separately. Missing source roots produce a
warning; restore them or update .redscript and refresh the workspace. Analysis
can be slow in large workspaces.
Use the Redscript IDE extension from the marketplace.
Associate "*.script": "redscript" under files.associations if your extension
version does not already attach to REDmod files.
- Install the
REDscriptextension from the marketplace. - Associate
.scriptwith the extension's language insettings.json:"file_types": { "REDscript": ["**/*.reds", "**/*.script"] }
- Ensure the
redscript-ideexecutable is on yourPATH. Optionally setlsp.redscript-ide.initialization_options.game_dir(orcache_file) insettings.jsonto load a local or modded game cache (see Configuration).
Use the (work in progress) Redscript-IntelliJ Plugin.
With Neovim 0.11 or newer, add the following to init.lua. This uses the
built-in LSP configuration API; nvim-lspconfig is not required. Replace
/path/to/redscript-ide with a downloaded
executable, and set
init_options.game_dir (or cache_file) as needed (see
Configuration).
vim.filetype.add({
extension = {
reds = 'redscript',
script = 'redmod',
},
})
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('RedscriptSyntax', { clear = true }),
pattern = 'redscript',
callback = function(args)
vim.bo[args.buf].syntax = 'swift'
end,
})
vim.lsp.config('redscript_ide', {
cmd = { '/path/to/redscript-ide' },
filetypes = { 'redscript', 'redmod' },
root_markers = { '.redscript', '.git' },
init_options = {
game_dir = '/path/to/cyberpunk2077',
},
})
vim.lsp.enable('redscript_ide')Create a .redscript file (it can be empty) at the workspace root so .reds
and .script files share one project and source roots. Community .reds files
use Swift syntax highlighting as an approximate fallback; for grammar-accurate
highlighting, remove the RedscriptSyntax autocmd and use
tree-sitter-reds for the
redscript filetype and
tree-sitter-redmod for the
redmod filetype, with each grammar's matching queries. Restart Neovim, then
verify with :set filetype? and :checkhealth vim.lsp.
-
Install Helix 25.07.1 or newer, Git, and a C/C++ toolchain: Visual Studio Build Tools with the C++ workload on Windows, or
xcode-select --installon macOS. -
Run the setup command for your platform (no checkout needed). These commands download and execute code from GitHub; review the linked scripts first.
Windows (PowerShell script):
Invoke-RestMethod https://raw.githubusercontent.com/jac3km4/redscript-ide/main/scripts/helix/setup-windows.ps1 | Invoke-Expression
macOS (shell script):
curl -fsSL https://raw.githubusercontent.com/jac3km4/redscript-ide/main/scripts/helix/setup-macos.sh | shSetup installs the latest
redscript-iderelease into Helix'sbindirectory, builds the pinned REDscript and REDmod grammars with their highlighting queries, and appends the language configuration to your userlanguages.toml. It backs up any file it modifies and stops with instructions if that file already mentions REDscript or REDmod. SetREDSCRIPT_GAME_DIR(or pass-GameDiron Windows) to point at a game install, and pass a runtime directory as the first argument (or-Runtimeon Windows) to override the default runtime location. -
Setup auto-detects Cyberpunk 2077 in Steam libraries (plus GOG/Epic records on Windows and common bundle locations on macOS). If detection fails, it warns and leaves
game_dirempty so the server uses the bundled base-game API cache. To load a local or modded game cache instead, setgame_dirin your userlanguages.tomlto the game install root. -
Create a
.redscriptfile (it can be empty) at your workspace root and restart Helix..redsand.scriptuse separate grammars with the shared language server; see REDmod support. Check setup withhx --health redscriptandhx --health redmod; missing indentation and text-object queries are expected.
