Skip to content

MillenniumDawn/cwtools-vscode

Repository files navigation

Paradox Language Features for Visual Studio Code

Origin

This is a fork of cwtools/cwtools-vscode. The original extension wrapped an F# language server from cwtools/cwtools; this fork has moved to a Rust-based server binary (cwtools-rs) and ships that.

Disclaimer

This extension is still in preview, it may not work, it may stop working at any time. Make backups of your mod files.

Supported games

  • Stellaris
  • Hearts of Iron IV
  • Europa Universalis IV
  • Europa Universalis V - in progress, help needed
  • Imperator: Rome - outdated, help needed
  • Crusader Kings II - partial
  • Crusader Kings III - in progress, help needed
  • Victoria 2 - in progress, help needed
  • Victoria 3 - in progress, help needed

Features

  • Immediate highlighting of syntax errors
  • Autocomplete while you type, providing descriptions when available
  • Tooltips on hover showing:
    • Related localisation
    • Documentation for that element
    • Scope context at that position
  • A wide range of validators for common, interface, and events, checking
    • That required localisation keys are defined
    • Existence of effects/triggers/modifiers
    • Scope context for used effects/triggers/modifiers
    • Usage of scripted effects/triggers
    • Correct entries for weights/AI_chance/etc
    • That event_targets are saved before they're used
    • That referenced sprites and graphics files exist
    • and a number of other specific validators

Usage

  1. Install this extension
  2. Open your mod folder directly, which should be within a folder containing the game name:
  • C:\Users\name\Documents\Paradox Interactive\Stellaris\mod\your_mod
  1. Follow the prompts to select your vanilla folder
  2. Edit files and watch syntax errors show up when you make mistakes
  3. Wait up to a minute for the extension to scan your mod and find errors

Multiple mods - workspace

If you have multiple mods that need to be loaded at once, use VS Code's multi-root workspace feature.

  1. Open your first mod
  2. Use "File", "Add folder to workspace" to add your next mod
  3. cwtools should reload including both mods and vanilla in context using correct mod load order

If you want to browse vanilla files, you can use the "CWTOOLS LOADED FILES" section in the Explorer tab.

Completion

Completion

Tooltips

Tooltips

Scope tooltips

Scope tooltips

Scope errors

Scope

Localisation error

Localisation error

Go to definition

Go to definition

Find all references

Find all references

Background reindex

The extension periodically re-scans the whole workspace in the background, so files changed outside the editor and definitions moved between files don't go stale until you reload the window. The rescan is idle-gated: it waits until you stop typing before running. To force one immediately, run cwtools: Re-index workspace from the command palette. The cwtools.backgroundReindex.intervalMinutes setting controls the interval (default 30; set it to 0 to disable the automatic pass).

Theming

The extension ships its own TextMate grammar for the supported games, so syntax highlighting works out of the box. No second extension to install.

The grammars are vendored from cwtools/paradox-syntax (see tools/sync-paradox-syntax.sh to refresh them); the .cwt rules grammar is owned here. Themes live under release/themes/. Every theme paints the full scope set from both grammars (game scripts and .cwt rule files) plus a generic baseline, so coloring is consistent whatever file you're in. Pick one with the Color Theme picker:

Highlighting runs off a single merged paradox grammar, with each game's keywords folded into it, so there are no separate per-game grammar files to keep in sync.

Credits

The TextMate grammars under release/syntaxes/ are vendored from the cwtools/paradox-syntax extension (Copyright (c) 2018 Thomas Boby, MIT). Original authors and contributors:

The bundled themes draw on the following:

cwtools-md-edition itself is a fork of cwtools/cwtools-vscode maintained by the Millennium Dawn mod team, and drives a Rust language server from MillenniumDawn/cwtools.

Links

About

A VS Code extension providing language server support for paradox script files using cwtools

Topics

Resources

License

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors