Hello, i am currently developing a plugin for Rider for the company i work at.
Basically i want to be able to select a string and a dictionary from the variables list, read their values and replace the values from the dictionary in the selected string.
I am already able to do most of that, but the biggest problem i have is getting the variables values.
At the moment, i access them like so:
val nodes = XDebuggerTreeActionBase.getSelectedNodes(e.dataContext)
nodes.filterIsInstance().forEach { node →
when (builder.classifyNode(node)) {
NodeType.SqlText → builder.sql = node.rawValue?.toString().orEmpty()
else → builder.collectParams(node)
}
The rawValue sadly does not contain the real variable value, for instance when the string value is really long, it cuts off with … at some place. Is there any way, to just get the real current value of the variable?
After hours and days of searching i finally found a solution for this problem
fun getNodeFullValue(node: XValueNodeImpl): String {
val latch = java.util.concurrent.CountDownLatch(1)
var result: String? = null
node.fullValueEvaluator!!.startEvaluation(object : XFullValueEvaluator.XFullValueEvaluationCallback {
override fun evaluated(value: String, font: Font?) {
result = value
latch.countDown()
}
override fun errorOccurred(errorMessage: String) {
result = "ERROR: $errorMessage"
latch.countDown()
}
})
latch.await() // Blockiert bis evaluated() oder errorOccurred() aufgerufen wurde
return result ?: ""
}