GithubHelp home page GithubHelp logo

Comments (7)

ligee avatar ligee commented on August 16, 2024

It's a bit complicated and also the area where we're going to change thing soon, so we'll update the description later, but for an example what works now, you may have a look at simple-main-kts here.
It works by 1) putting the definition into the separate module, and 2) include it as a dependency to the use-site module. A possible quirk is that you may need to compile the definition module and then reload the project in IntelliJ to make it work.

from kotlin-script-examples.

sschuberth avatar sschuberth commented on August 16, 2024

you may need to compile the definition module and then reload the project in IntelliJ to make it work.

That's indeed one of the (undocumented) pitfalls I ran into, but I eventually got it working in oss-review-toolkit/ort#4887.

from kotlin-script-examples.

Cottand avatar Cottand commented on August 16, 2024

Hi I am also looking to get autocompletion going in a custom script inside IntelliJ. Is this still up to date? The current KEEP mentions something about extra gradle config with the kotlinScriptDef configuration. I am not seeing that anywhere here

from kotlin-script-examples.

sschuberth avatar sschuberth commented on August 16, 2024

extra gradle config with the kotlinScriptDef configuration. I am not seeing that anywhere here

For the record, I'm also not using the kotlinScriptDef configuration in https://github.com/oss-review-toolkit/ort but still auto-completion works for the file at https://github.com/oss-review-toolkit/ort/blob/main/examples/evaluator-rules/src/main/resources/example.rules.kts.

I guess you only need the kotlinScriptDef configuration if your project does not anyway depend (via the implementation configuration) on the module that contains the script definitions.

from kotlin-script-examples.

gottagofaster236 avatar gottagofaster236 commented on August 16, 2024

It works by 1) putting the definition into the separate module, and 2) include it as a dependency to the use-site module.

Is there a way to have autocompletion for standalone scripts outside a project?

from kotlin-script-examples.

TWiStErRob avatar TWiStErRob commented on August 16, 2024

If by "standalone" you mean standard .main.kts files, we get "Apply Context" for those in the top right. I'm using IntelliJ IDEA 2023.2.2 Ultimate with Kotlin plugin 232-1.9.0.

from kotlin-script-examples.

dpeter99 avatar dpeter99 commented on August 16, 2024

Are there any updates on this? It would be instrumental to be able to offer code completion in projects where the build system is not gradle and the script files are being used as config for custom tooling. (only the final jar is present that has the scripting host)

from kotlin-script-examples.

Related Issues (13)

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.