I noticed pythonDatastoreVariableSymbols would give inconsistent results when the document is edited.
Steps to reproduce:
Create the following document:
python() {
d.getVar('DESCRIPTION')
}
Restart VS Code (just making sure to have a clean state) and open the document.
Try to hover DESCRIPTION. It works.
Try to rename DESCRIPTION. It works.
Change the quotes:
python() {
d.getVar("DESCRIPTION")
}
Try to hover DESCRIPTION. It still works.
Try to rename DESCRIPTION: The element can't be renamed (???)
Save the document and restart VS Code.
Try to rename DESCRIPTION: It works.
Not sure why this happens (bitBakeNodeAtPoint gives a different result after the edition), but here's a fix.
Problem has been understood: bitBakeNodeAtPoint uses the tree registered in uriToAnalyzedDocument. However, getSymbolsFromBitBakeTree is called before the new tree is registered. Therefore, if bitBakeNodeAtPoint is called whithin getSymbolsFromBitBakeTree, it will give a result from the previous tree. For that reason, it must be avoided.
I noticed pythonDatastoreVariableSymbols would give inconsistent results when the document is edited.
Steps to reproduce:
DESCRIPTION
. It works.DESCRIPTION
. It works.DESCRIPTION
. It still works.DESCRIPTION
:The element can't be renamed
(???)DESCRIPTION
: It works.Not sure why this happens (bitBakeNodeAtPoint
gives a different result after the edition), but here's a fix.Problem has been understood: bitBakeNodeAtPoint uses the tree registered in uriToAnalyzedDocument. However, getSymbolsFromBitBakeTree is called before the new tree is registered. Therefore, if bitBakeNodeAtPoint is called whithin getSymbolsFromBitBakeTree, it will give a result from the previous tree. For that reason, it must be avoided.