Comments (10)
ah - issue is that
from jbang-idea.
How about following code? IDEA treats line break as \n
, no \r
in IDEA editor.
if (!(code.contains("///usr/bin/env jbang")
|| code.startsWith("//DEPS ")
|| code.contains("\n//DEPS "))) return false
Regex is not performance well for long text.
from jbang-idea.
I don't think regex of the type just checking start of line is much slower than checking a string contains something.
But anyhow - thinking about this we don't really want the existing ones for java to disappear as it's still very feasible to run/debug the file directly.
Can we just add to list of existing one (run,debug, etc) without removing them ?
from jbang-idea.
Yes, you can. Now run by JBang is the first option, and you can run it as Normal Java class from More Run/Debug
. You should right click outside of class. It's some tricky and maybe it's bug of IntelliJ IDEA. I will submit an issue to jetbrains and confirm it.
from jbang-idea.
no way to make jbang show up in more run/debug instead of "overtaking" the UI ?
from jbang-idea.
Another options is to use external tools in IDEA. External tool will not modify anything to Run Configurations
and nothing changed to editor popup menu. Just add JBang under External Tools
, and of course you can assign shortcut for it.
But I think external tool is not good idea, hard to add options and arguments. Maybe we should both options to run JBang script.
Run configuration is controlled by IDE, and it's some hard to change. I will take a look at priority available or not for run configuration.
from jbang-idea.
One more options: if right click in JBang directives, and JBang will be first run option, and native run configuration will be first in other location.
If ///usr/bin/env jbang
available, and a run button will be added in the gutter of line to run script by JBang.
from jbang-idea.
@maxandersen How about new implementation?
Right Click in JBang directives area, then you can choose Run Hello.java by JBang
:
In other area, Run by JBang
will be disabled and only run normal Java class available.
Line marker will add jbang icon to run script when ///usr/bin/env jbang
available in script file.
<runLineMarkerContributor language="JAVA" implementationClass="dev.jbang.idea.run.JBangRunLineMarkerContributor"/>
from jbang-idea.
I think that makes sense as it's more the file you run than the class.
Maybe also recognize //DEPS and //JAVA in beginning of line as the /// marker is not a hard requirement?
from jbang-idea.
line marker adjusted:
- icon for
///usr/bin/env jbang
if available - Icon for
//JAVA
if///usr/bin/env jbang
absent - Icon for first
//DEPS
if///usr/bin/env jbang
and//JAVA
absent
from jbang-idea.
Related Issues (20)
- Support IDEA 2022.2 EAP HOT 1
- use private artifactory to sync deps to module HOT 3
- Plugin doesn't aknowledge JBANG_HOME
- Running JBang as a Scratch file will not set the Script file attribute properly HOT 3
- cannot create jbang script in intellij idea HOT 10
- Unable to create a JBang script from Intellij HOT 3
- Sync 'JBang DEPS to Module' fails with 'Could not execute [/Users/cer/.jbang/bin/jbang' HOT 2
- JBang not listed in project generators HOT 3
- NPE running "New/JBangScript" in IntelliJ 2022.3.3 HOT 1
- jbang edit --open=idea Test.kt doesn't work with IntelliJ 2022.3.3 HOT 5
- IDEA does not see jbang installed with scoop HOT 2
- Use `hello = Basic Hello World template` as the default option when creating a new JBang Script HOT 1
- Plugin doesn't work with latest IDEA HOT 1
- Exception when synching deps with 2023.2.1
- JBang Scripts Inside a Maven Project HOT 2
- Exception on IntelliJ 2023.2.3
- Support IDE build 233.x HOT 3
- Code completion does not work with native edit HOT 5
- Improve the Jbang experience in IntelliJ HOT 3
- `ActionUpdateThread.OLD_EDT` is deprecated and going to be removed soon.
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 jbang-idea.