Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/main/java/org/javacs/FileStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ public static String contents(Path file) {

static InputStream inputStream(Path file) {
var uri = file.toUri();
if (activeDocuments.containsKey(uri)) {
var string = activeDocuments.get(uri).content;
file = Paths.get(uri);

if (activeDocuments.containsKey(file)) {
var string = activeDocuments.get(file).content;
var bytes = string.getBytes();
return new ByteArrayInputStream(bytes);
}
Expand All @@ -275,8 +277,10 @@ static InputStream inputStream(Path file) {

static BufferedReader bufferedReader(Path file) {
var uri = file.toUri();
if (activeDocuments.containsKey(uri)) {
var string = activeDocuments.get(uri).content;
file = Paths.get(uri);

if (activeDocuments.containsKey(file)) {
var string = activeDocuments.get(file).content;
return new BufferedReader(new StringReader(string));
}
try {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/javacs/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ long lastCursorIn(Tree node) {
}
if (last == -1) {
throw new RuntimeException(
String.format("No cursor in %s is between %d and %d", offsets, start, end));
String.format(
"No cursor in %s is between %d and %d", Arrays.toString(offsets), start, end));
}
return last;
}
Expand Down