I am doing some static code analysis of code in a few languages, like Python, and want to be able to display that code with some kind of UI that shows the results of the static code analysis in the form of popups and navigation.
For example, if I parse a function call to order_product
with argument variable product
that has the value red delicious apple
.
def example():
product = "red delicious apple"
order_product(product, 6)
I want the user to see that the variable product
is highlighted and there is a popup that describes what we know about the possible values, in this case “red delicious apple” with the classification “food”. Or perhaps the highlighting of the code block for product
has a color that corresponds to the classification.
Futhermore, suppose the implementation of the called function order_product
sends the value of product
to some web service:
def order_product(item, qty):
client = connect(servicename)
client.send({"item": item, "qty": qty)
The static analysis has performed this trace, and I want to have some kind of UI that lets the user see that. THey would click on the product
variable in the first code block and the editor navigates to the send
call in the second block.
I feel that a language server extension for VS Code might be one way to do this, but it is not clear. All the literature on it talks about things like syntax highlighting and editing activities for various languages. What I want is to have a table of all the code blocks with metadata and instruct VS Code to render that information in certain ways.
Can someone shed some light on how I might go about doing this?
Thank you.
Google searching on VS Code extensions and reading documentation on the language server.
Brian Kramer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.