Comments (7)
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.
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.
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.
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.
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.
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.
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)
- KotlinJsr223DefaultScriptEngineFactory not needed anymore? HOT 1
- embeddableTest.kt in jvm-embeddabble-host fails.
- request: sample to get return value of eval
- Consider editing repository setings to remove "Packages" section
- No Simple Example Exists HOT 4
- Using ScriptEngineManager to eval a class script file returns null
- Unable to find extension point configuration extensions/compiler.xml
- JSR223 tests fail with NPE at getEngine call HOT 1
- Can't bind to engine HOT 1
- No documentation provided for Repository interface HOT 1
- Some main.kts examples
- Caused by: javax.script.ScriptException: Unresolved reference: Import HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-script-examples.