-
Notifications
You must be signed in to change notification settings - Fork 380
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
Enable .java Filename Completion for java Command #1196
Comments
Modify java command completion scripts to also complete filenames with the .java extension. This adds support for - JEP 330: Launch Single-File Source-Code Programs - JEP 458: Launch Multi-File Source-Code Programs Closes scop#1196
Modify java command completion scripts to also complete filenames with the .java extension. This adds support for - JEP 330: Launch Single-File Source-Code Programs - JEP 458: Launch Multi-File Source-Code Programs Closes scop#1196 Co-authored-by: frankslin <[email protected]>
The completion could be further improved by having the completion suggest only Files without the Perhaps complete on Following the implementation of JEP 477, the static void main(String[] args) {
println("Hello, World!");
} static void main() {
println("Hello, World!");
} void main(String[] args) {
println("Hello, World!");
} void main() {
println("Hello, World!");
} I don't know if it is feasible or how it could be implemented. |
To perform that robustly, we would need a compiler or, at least, a Java parser. If the One might think it could be possible to detect the main function by matching a fixed string, but it's not robust. That can mistakenly hit an unrelated string in a code comment, or it might miss the actual main function by a tiny style difference. I'm not sure if we should add the completions that can produce wrong results randomly at a small probability, because the users would learn to believe the list generated by |
Modify java command completion scripts to also complete filenames with the .java extension. This adds support for - JEP 330: Launch Single-File Source-Code Programs - JEP 458: Launch Multi-File Source-Code Programs Closes #1196 Co-authored-by: frankslin <[email protected]>
Description
Enhance the bash completion scripts for the
java
command to complete filenames with the.java
extension.This enhancement is necessary to support:
which allows the java launcher to run a program supplied as a single file of Java source code:
The text was updated successfully, but these errors were encountered: