-
Notifications
You must be signed in to change notification settings - Fork 323
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
Inline Execution #8148
Merged
Merged
Inline Execution #8148
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
90c15cd
misc: engine cleanup
4e6 d27095c
DRAFT: evaluate expression in local scope
4e6 bd3a50a
fix: execution of evaluated expression
4e6 05a7de8
feat: use eval node
4e6 bd9e079
feat: eval expression in local scope
4e6 ab10601
feat: update executeExpression command
4e6 ffa306e
test: execute expression
4e6 976e9c6
fix: imports
4e6 a77971e
feat: on executed visualization callback
4e6 8473dc5
misc: cleanup execute local scope
4e6 4d747b3
misc: cleanup send visualization update
4e6 298430e
misc: visualizations iterator
4e6 8f74b32
misc: remove ExecutionSupport interface
4e6 2bffc05
misc: cleanup
4e6 3ef9845
misc: cleanup instrumentor builtin
4e6 f37941c
Merge branch 'develop' into wip/db/8132-inline-execution
4e6 4a39ee7
feat: node info interface
4e6 f1121ec
fix: language server tests
4e6 552207a
misc: javafmt
4e6 a002322
fix: native image
4e6 f1fd117
docs: update language server protocol
4e6 96cff69
docs: new data structures
4e6 149ccaa
misc: cleanup execution service
4e6 b24582c
misc: javafmt
4e6 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...ver/src/main/scala/org/enso/languageserver/runtime/handler/ExecuteExpressionHandler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.enso.languageserver.runtime.handler | ||
|
||
import akka.actor.{Actor, ActorRef, Cancellable, Props} | ||
import akka.pattern.pipe | ||
import com.typesafe.scalalogging.LazyLogging | ||
import org.enso.languageserver.requesthandler.RequestTimeout | ||
import org.enso.languageserver.runtime.{ | ||
ContextRegistryProtocol, | ||
RuntimeFailureMapper | ||
} | ||
import org.enso.languageserver.util.UnhandledLogging | ||
import org.enso.polyglot.runtime.Runtime.Api | ||
|
||
import java.util.UUID | ||
|
||
import scala.concurrent.duration.FiniteDuration | ||
|
||
/** A request handler for execute expression commands. | ||
* | ||
* @param runtimeFailureMapper mapper for runtime failures | ||
* @param timeout request timeout | ||
* @param runtime reference to the runtime connector | ||
*/ | ||
class ExecuteExpressionHandler( | ||
runtimeFailureMapper: RuntimeFailureMapper, | ||
timeout: FiniteDuration, | ||
runtime: ActorRef | ||
) extends Actor | ||
with LazyLogging | ||
with UnhandledLogging { | ||
|
||
import context.dispatcher | ||
|
||
override def receive: Receive = requestStage | ||
|
||
private def requestStage: Receive = { case msg: Api.ExecuteExpression => | ||
runtime ! Api.Request(UUID.randomUUID(), msg) | ||
val cancellable = | ||
context.system.scheduler.scheduleOnce(timeout, self, RequestTimeout) | ||
context.become(responseStage(sender(), cancellable)) | ||
} | ||
|
||
private def responseStage( | ||
replyTo: ActorRef, | ||
cancellable: Cancellable | ||
): Receive = { | ||
case RequestTimeout => | ||
replyTo ! RequestTimeout | ||
context.stop(self) | ||
|
||
case Api.Response(_, Api.VisualizationAttached()) => | ||
replyTo ! ContextRegistryProtocol.VisualizationAttached | ||
cancellable.cancel() | ||
context.stop(self) | ||
|
||
case Api.Response(_, error: Api.Error) => | ||
runtimeFailureMapper.mapApiError(error).pipeTo(replyTo) | ||
cancellable.cancel() | ||
context.stop(self) | ||
} | ||
|
||
} | ||
|
||
object ExecuteExpressionHandler { | ||
|
||
/** Creates configuration object used to create a [[ExecuteExpressionHandler]]. | ||
* | ||
* @param runtimeFailureMapper mapper for runtime failures | ||
* @param timeout request timeout | ||
* @param runtime reference to the runtime connector | ||
*/ | ||
def props( | ||
runtimeFailureMapper: RuntimeFailureMapper, | ||
timeout: FiniteDuration, | ||
runtime: ActorRef | ||
): Props = | ||
Props( | ||
new ExecuteExpressionHandler(runtimeFailureMapper, timeout, runtime) | ||
) | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
engine/polyglot-api/src/main/java/org/enso/polyglot/debugger/ExecutedVisualization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.enso.polyglot.debugger; | ||
|
||
import java.util.UUID; | ||
|
||
public record ExecutedVisualization( | ||
Object result, | ||
Throwable error, | ||
UUID visualizationId, | ||
UUID expressionId, | ||
Object expressionValue) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Doing
flatMap
and thenSome
is strange.map
is better.