Giter VIP home page Giter VIP logo

redscript-ide's Introduction

redscript-ide

Language server for redscript

features

  • error and warning diagnostics
  • autocompletion for methods and fields
  • hover for function definitions and types

ide-gif

redscript-ide's People

Contributors

jac3km4 avatar jackhumbert avatar roms1383 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

redscript-ide's Issues

Semantic error: Static method invocation using `this` qualifier

Static method invocations using the this qualifier are not allowed in redscript. The IDE allows this semantic.

Example

public class EdgerunningRecoverySystem extends ScriptableSystem {

  private func GetRecoverHumanityPeriodInc() -> Float {
   [...]
    let recoveryRate = this.GetRecoverHumanityRate(this.config.recoveryRate, this.config.recoveryThres, freeLoad);
    LDebug(s"Recovery rate is \(recoveryRate). rate = \(this.config.recoveryRate), thres = \(this.config.recoveryThres), freeLoad = \(freeLoad)");

    let inc = recoveryRate * dayFrac;
    LDebug(s"Recovery increment is \(inc). dayFrac = \(dayFrac)");
    return inc;
  }


  public static func GetRecoverHumanityRate(const rate: Float, const thres: Float, const load: Float) -> Float {
    [...]
  }
}

The above syntax is valid for the IDE, but yields the following compilation error:

2022-11-09T12:52:02.2708629+01:00 [ERROR] At D:\Program Files\Steam\steamapps\common\Cyberpunk 2077\r6\scripts\WannabeEdgerunnerRecovery\core\System.reds:180:24:
    let recoveryRate = this.GetRecoverHumanityRate(this.config.recoveryRate, this.config.recoveryThres, freeLoad);
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
method GetRecoverHumanityRate;FloatFloatFloat is static

2022-11-09T12:52:49.7671769+01:00 [ERROR] Compilation error: REDScript compilation failed. The game will start, but none of the scripts will take effect. This is caused by errors in:
- WannabeEdgerunnerRecovery
You can try updating or removing these scripts to resolve the issue. If you need more information, consult the logs.

The error can be fixed using explicit type qualification.

    let recoveryRate = EdgerunningRecoverySystem.GetRecoverHumanityRate(this.config.recoveryRate, this.config.recoveryThres, freeLoad);

Solution

Check for the static modifier for symbols when using the this qualifier, and yield an equivalent error to the compiler.

Postscriptum: Love this project

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.