-
Notifications
You must be signed in to change notification settings - Fork 159
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
Quality-of-life improvements for edit
#1211
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1211 +/- ##
============================================
- Coverage 58.82% 58.67% -0.15%
- Complexity 1057 1058 +1
============================================
Files 86 86
Lines 5661 5689 +28
Branches 954 960 +6
============================================
+ Hits 3330 3338 +8
- Misses 1839 1858 +19
- Partials 492 493 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
2deb5a2
to
9731e23
Compare
} | ||
|
||
private static List<String> findEditorsOnPath() { | ||
return Arrays.stream(knownEditors).filter(e -> Util.searchPath(e) != null).collect(Collectors.toList()); |
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.
this won't find editors on windows where they potentially have .exe/.bat/.cmd/.ps1/etc suffixes.
would need to search with multiple suffixes.
Another option is to scan running processes to help decide which one wins.
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.
Tsk tsk tsk, ye of little faith :-)
public static Path searchPath(String name) {
String envPath = System.getenv("PATH");
envPath = envPath != null ? envPath : "";
return Arrays .stream(envPath.split(File.pathSeparator))
.map(Paths::get)
.filter(p -> isExecutable(p.resolve(name))) <########
.findFirst()
.orElse(null);
}
private static boolean isExecutable(Path file) {
if (Files.isExecutable(file)) {
if (Util.isWindows()) {
String nm = file.getFileName().toString().toLowerCase();
#######> return nm.endsWith(".exe") || nm.endsWith(".bat") || nm.endsWith(".cmd") || nm.endsWith(".ps1");
} else {
return true;
}
}
return false;
}
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.
Still, it did not actually work as advertised 😅 But it's fixed now.
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.
:)
a923119
to
f976f53
Compare
f976f53
to
5595b4d
Compare
In case no managed VSCodium is installed, Jbang will now search the user's PATH for well-known editors and present them as additional options next to offer of downloading VSCodium. If the user selects one of the editors found on the PATH, Jbang will show the `config` command the user can use to set that option as the default for future invocations. A new option was added to explicitely exit without doing anything. Fixes jbangdev#1210
5595b4d
to
5fef94e
Compare
when I build this the tests never completes? or it at least been running for over 10 minutes now... |
hmm - seems I nuked my maven repo and we have some big resolves .... |
works pretty nice - i'm torn on wether vscodium should still be treated special. i.e. once you installed vscodium you wont get the question about which IDE to use...but if I choose idea/eclipse/code I'm just told to manually set the config... |
In case no managed VSCodium is installed, Jbang will now search the
user's PATH for well-known editors and present them as additional
options next to offer of downloading VSCodium.
If the user selects one of the editors found on the PATH, Jbang will
show the
config
command the user can use to set that option as thedefault for future invocations.
A new option was added to explicitely exit without doing anything.
Fixes #1210