New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add jbang #118
add jbang #118
Conversation
mentioned in #117 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Added some comments below. In response to your question about making sure Java is available during installation, that's what the prepare
block is for. There are some examples in the installation tutorial, e.g. https://github.com/raxod502/riju/blob/master/doc/tutorial/install.md#compile-from-source.
I'd like to keep JBang separate from Java since I feel it is really a different language, even if it's very similar. But no objection to having them both in parallel.
trace: | ||
server: "off" | ||
code: "TODO" | ||
item: "TODO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind including the changes from #121 to the language server configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Btw. Do you know of a way to have the lsp run on the directory output of a command ? Jbang can set up ide workspace that has dependencies etc. Configured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, you'll probably want to do something like for Q# where you also install the language at build time, and use its tooling to generate a project skeleton:
Which can then be populated into the runtime directory at container start:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more the other way.
Need to run 'jbang edit --no-open main.java' which scans the java code and sets up the right ide metadata. Can also run with --live to have it continuously update it if java dependencies changes.
Note it's just relevant for the Lsp so might just be enough do it when user toggle it on/off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Well, if you need to have the user code before starting LSP, then you probably want to put this into the lsp.start
command, as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem like they should be part of the same language, instead of being separate. We generally don't have multiple different variants for a language.
jshell is a variance of java used for jshell.
jbang is just wrapping it here.
Can't have it in one language as it requires a different named file (.jsh vs .java).
Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
I've updated jbang w/java and also added a JShell variant which adds repl support.. btw. how does one come back to the repl after having pressed run ? |
@@ -0,0 +1,138 @@ | |||
id: "jbang" | |||
name: "Java w/JBang" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw. not too hapy about this name but just putting "JBang" means java users wont find it.
The contract is described here: https://github.com/raxod502/riju/blob/1c8b0e14529d8b37eead3fd939612b9d518f1985/doc/tutorial/run.md#languages-with-repls In other words, a repl should always be started automatically after the code is run, for languages that have repls.
These seem like they should be part of the same language, instead of being separate. We generally don't have multiple different variants for a language.
I think we may have to live with that for now; I'd like to keep the language names canonical for now. A better way to make JBang discoverable for users looking for Java would be to add an explicit language search option which can index on more metadata than just the language name (see #125). |
manual: | | ||
install -d "${pkg}/usr/local/bin" | ||
curl -Ls https://sh.jbang.dev | bash -s - app setup | ||
cp ~/.jbang/bin/* "${pkg}/usr/local/bin/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cp ~/.jbang/bin/* "${pkg}/usr/local/bin/" | |
cp "$HOME/.jbang/bin"/* "${pkg}/usr/local/bin/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay here.
It sounds like JShell is actually an official part of Java, which I didn't realize at first. Because of that, I think it would make more sense to include it directly into Riju's primary Java support. Ideally, we would have JShell support in both Java and JBang.
Can't have it in one language as it requires a different named file
JShell should be able to interoperate with traditional Java code (.java
), right? It's just that the code has to be standard Java, rather than JShell input. You should be able to import and run Java code from files in your working directory, which lines up with how repl/run integration works for most languages on Riju.
So if we did things this way, langs/java.yaml
would grow new repl
and scope
options, and we'd also have most of the same options in langs/jbang.yaml
.
This thread is being closed automatically by Tidier because it is labeled with "waiting on response" and has not seen any activity for 90 days. But don't worry—if you have any information that might advance the discussion, leave a comment and I will be happy to reopen the thread :) |
This adds a
jbang
language but it would make more sense this was used byjava
to enable use of dependencies.
i.e. you can run this java code with this:
Notice the
//DEPS
line that is picked up by jbang to build and run with that dependency.I did try add install steps under manual but for some reason
java
is not availablewithin that making it difficult to install jbang using jbang itself.
Is there a way to have
java
available in themanual
section ?Otherwise I'll need to add more manual steps to install jbang.