Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -55,6 +55,7 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Segment;
|
||||
import jdk.jshell.DeclarationSnippet;
|
||||
import jdk.jshell.Diag;
|
||||
import jdk.jshell.JShell;
|
||||
import jdk.jshell.Snippet;
|
||||
@@ -185,7 +186,6 @@ public abstract class ShellPanel extends JPanel
|
||||
}
|
||||
|
||||
console.setFont(codeFont);
|
||||
console.setFocusable(false);
|
||||
console.setEditable(false);
|
||||
console.setOpaque(false); // this turns off the hover effect for some reason
|
||||
|
||||
@@ -316,11 +316,13 @@ public abstract class ShellPanel extends JPanel
|
||||
{
|
||||
Snippet snip = ev.snippet();
|
||||
offsets.put("#" + snip.id(), thisOffset);
|
||||
if (ev.status() != Snippet.Status.VALID && ev.status() != Snippet.Status.RECOVERABLE_DEFINED)
|
||||
if (ev.status() != Snippet.Status.VALID)
|
||||
{
|
||||
boolean handled = false;
|
||||
var diags = shell.diagnostics(snip).collect(Collectors.toList());
|
||||
for (var diag : diags)
|
||||
{
|
||||
handled = true;
|
||||
String msg = toStringDiagnostic(src, thisOffset, diag);
|
||||
if (isUserCode)
|
||||
{
|
||||
@@ -332,11 +334,23 @@ public abstract class ShellPanel extends JPanel
|
||||
throw new RuntimeException("prelude error: " + msg);
|
||||
}
|
||||
}
|
||||
if (diags.isEmpty())
|
||||
if (snip instanceof DeclarationSnippet)
|
||||
{
|
||||
var unresolved = shell.unresolvedDependencies((DeclarationSnippet) snip).collect(Collectors.toList());
|
||||
for (var ident : unresolved)
|
||||
{
|
||||
handled = true;
|
||||
logToConsole("Unresolved symbol: " + ident);
|
||||
}
|
||||
}
|
||||
if (!handled)
|
||||
{
|
||||
logToConsole("bad snippet" + ev.status());
|
||||
}
|
||||
break evaluation;
|
||||
if (ev.status() != Snippet.Status.RECOVERABLE_DEFINED)
|
||||
{
|
||||
break evaluation;
|
||||
}
|
||||
}
|
||||
if (ev.exception() != null)
|
||||
{
|
||||
@@ -419,18 +433,23 @@ public abstract class ShellPanel extends JPanel
|
||||
|
||||
private void cleanup()
|
||||
{
|
||||
for (var c : cleanup)
|
||||
{
|
||||
try
|
||||
{
|
||||
c.run();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
shellLogger.error("Cleanup threw:", e);
|
||||
}
|
||||
}
|
||||
var todo = new ArrayList<>(cleanup);
|
||||
cleanup.clear();
|
||||
|
||||
invokeOnClientThread(() ->
|
||||
{
|
||||
for (var c : todo)
|
||||
{
|
||||
try
|
||||
{
|
||||
c.run();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
shellLogger.error("Cleanup threw:", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract void invokeOnClientThread(Runnable r);
|
||||
|
||||
Reference in New Issue
Block a user