Giter VIP home page Giter VIP logo

rms-check's Introduction

rms-check

A linter and language server for Age of Empires 2 random map scripts.

Usage - Status - Install - License: GPL-3.0

Usage

rms-check is available both as a command-line program and as an extension for VS Code.

VS Code Extension

Please see vscode/ for the VS Code extension.

VS Code integration

CLI

rms-check 0.0.4
Syntax checking and linting tool suite for Age of Empires 2 random map scripts

USAGE:
    rms-check [FLAGS] [file] [SUBCOMMAND]

FLAGS:
        --aoc        Set the default compatibility to Age of Conquerors. Scripts can override this using `/*
                     Compatibility: */` comments
        --de         Set the default compatibility to Definitive Edition. Scripts can override this using `/*
                     Compatibility: */` comments
    -h, --help       Prints help information
        --hd         Set the default compatibility to HD Edition. Scripts can override this using `/* Compatibility: */`
                     comments
        --up14       Set the default compatibility to UserPatch 1.4. Scripts can override this using `/* Compatibility:
                     */` comments
        --up15       Set the default compatibility to UserPatch 1.5. Scripts can override this using `/* Compatibility:
                     */` comments
    -V, --version    Prints version information
        --wk         Set the default compatibility to WololoKingdoms. Scripts can override this using `/* Compatibility:
                     */` comments

ARGS:
    <file>    The file to check, when not using any subcommand

SUBCOMMANDS:
    check     Syntax check and lint a random map script
    fix       Auto-fix problems with a random map script
    format    Format the given file
    help      Prints this message or the help of the given subcommand(s)
    pack      Pack a folder into an Zip-RMS map
    server    Start the language server
    unpack    Unpack a Zip-RMS map into a folder
rms-check "/path/to/aoc/Random/Everything_Random_v4.3.rms"

Status

There is a simple parser and some lints for highlighting common problems.

There is also a language server implementation that provides diagnostics, folding ranges, and rudimentary formatting. In the future, I'd like to support more things, like context-aware completions and hover help.

Install

Currently no binaries are provided. Installation must be done by compiling this repository from source.

First, get rustup: https://rustup.rs/

Then do something like:

# download rms-check:
git clone https://github.com/goto-bus-stop/rms-check.git
cd rms-check
# build it:
cargo build --release
# run it!
./target/release/rms-check FILENAME

License

GPL-3.0

rms-check's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar goto-bus-stop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rms-check's Issues

Const Tracing

Zetnus showed a script like this:

if UP_EXTENSION #define RND_AVAILABLE
elseif DE_AVAILABLE #define RND_AVAILABLE
endif

if ALLOW_FULL_RANDOM_PLACEMENT
    if RND_AVAILABLE    /* a check for direct-placement support */
        start_random
            percent_chance 10    #define USE_FULL_RANDOM_PLACEMENT     
        end_random
    endif
endif

if USE_FULL_RANDOM_PLACEMENT
    direct_placement
endif

rms-check flags this as a potential compatibility issue. However, USE_FULL_RANDOM_PLACEMENT will only ever be defined if UP_EXTENSION or DE_AVAILABLE is defined, so this is actually fine. We could do dependency tracing of const definitions to account for this.

Beta Carnage

  • Missing avoid_cliff_zone
  • Missing avoid_all_actor_areas
  • place_on_forest_zone should not take an argument
  • Optional second argument to circle_radius is not supported
  • Missing default_terrain_replacement
  • Missing layer attributes
  • Missing create_connect_to_nonplayer_land
  • Compatibility messages are not comprehensive: eg some feature may be supported on UP 1.4 and HD

Context-aware completion

since tokens already have associated context information, we should be able to provide context-aware completions in the language server.

Use `bstr`

a lot of map scripts are written in different encodings, especially older ones. currently we run chardet on those but there's really no reason to convert them to utf8. the builtin tokens are all ascii and the game works on a byte level with custom const names anyway. with bstr we could treat non utf8 stuff as a str.

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.