Skip to content

chopeks/bb-idea-plugin

 
 

Repository files navigation

BB Squirrel Intellij plugin

Adds support for version of Squirrel used in Battle Brothers game, plus modding helpers.

Roughly based on original Squirrel plugin for Intellij README.md, but mostly rewritten from scratch.

Installation

  • Get Intellij IDEA with version at least 2024.2, Community or Ultimate, doesn't matter
  • Uninstall old Squirrel IDE plugin
  • Download the latest zip from the releases page.
  • Follow the install plugin from disk instructions
  • Add unpacked vanilla to the project and mark as source Right click | Mark directory as | Sources root
  • Mark mod directories as sources Right click | Mark directory as | Sources root
  • Mark mods or build directories you don't want indexed as Excluded
  • If completion doesn't work, rebuild indexes File | Invalidate caches | check first 2 options

Features

  • Supports multi-mod environment by tracking references in all relevant mods,
  • Reworked BNF based parser to fit BB version of Squirrel better,
    • NOTE: It's stricter when it comes to syntax than ingame interpreter, but is a bit more lenient than vanilla code is.
    • To check if there are syntax error, add it as source, then on mod Right click | Analyze | Inspect Code, it's requirement for code completion to work
  • New file templates for classes and modding related stuff
  • Code highlighting
  • BB aware .nut file structure validation
  • Block folding
  • Customizable code formatter
  • Live code validation and various on-demand inspections
  • Code completion for BB classes, modding hooks and modern hooks, also non-dynamic global variables,
    • for sanity only in :: and gt. spaces, this. is too ambiguous to resolve references consistently, refactor to ::
  • Find usage on 'class' names, to quickly find all hooks and references in code
  • String reference tracking (scripts, hooks and gfx files)
  • Images and colors used in code show on gutter
  • Marking directories as sources/exclude affects reference resolution scope
  • ... more coming? maybe

Contributions

It's MIT, feel free.

Plugin development prerequisites

  • Java 17+
  • IntelliJ

Plugin development environment

  • Install Grammar-Kit for *.bnf and *.flex file support
    • Adds BNF Grammars and JFlex files editing support including parser/PSI code generator
  • Clone repository
  • Follow instructions on the plugin development environment setup page
    • Enable the Gradle plugin
    • Enable the Plugin DevKit
  • Use File | New… | Project from Existing Sources and open the cloned repository directory

Testing the plugin locally

  • Run the Gradle runIde task which will start a new IntelliJ instance with the plugin installed.
  • Install PsiViewer on that instance to see how files are structured (Tools | View PSI structure for Current File...). It helps greatly when changing code in plugin.

About

Squirrel for Battle Brothers for IntelliJ IDEA

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 79.0%
  • Squirrel 8.1%
  • Java 7.2%
  • Lex 5.7%