sway_lsp::handlers::request

Function handle_show_ast

Source
pub async fn handle_show_ast(
    state: &ServerState,
    params: ShowAstParams,
) -> Result<Option<TextDocumentIdentifier>>
Expand description

This method is triggered by a command palette request in VScode The 3 commands are: “show lexed ast”, “show parsed ast” or “show typed ast”

If any of these commands are executed, the client requests this method by calling the “sway/show_ast”.

The function expects the URI of the current open file where the request was made, and if the “lexed”, “parsed” or “typed” ast was requested.

A formatted AST is written to a temporary file and the URI is returned to the client so it can be opened and displayed in a separate side panel.