Giter VIP home page Giter VIP logo

composable-function-reference-diagnostic-suppressor's Introduction

composer-function-reference-diagnostic-suppressor

COMPOSABLE_FUNCTION_REFERENCE diagnostic suppression Kotlin compiler plugin

Why?

We can use .name on reflection via double-clone(::) the function to get the name of the function.

fun main() {
    println(::hi.name) // hi
}

fun hi() {
    println("Say bye.")
}

This can be useful to avoid hardcoding function names. However, in the case of a Composable function, reference access is blocked.

Because of this limitation, hardcoding is required to get the name of the Composable function. This Kotlin compiler plugin was developed to avoid this limitation.

Download maven-central

version kotlin compatibility
maven-central kotlin-compatibility
repositories {
    maven {
        // We need the JB repository to get the Compose Compiler the latest version
        url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev")
    }
}

dependencies {
    add(
        org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME,
        "land.sungbin:composable.reference.suppressor.plugin:${version}"
    )
}

Caveat

Currently, no IDE support. [similar issue]

So if you try to reference a Composable function, you still get an error in the IDE. But when you actually run the build, it succeeds.

License

This project is licensed under the MIT License. Please refer to the LICENSE file for details.

composable-function-reference-diagnostic-suppressor's People

Contributors

jisungbin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

composable-function-reference-diagnostic-suppressor's Issues

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.