Currently, I'm developing a VS Code extension that focuses on parsing OpenAPI specifications. These specifications are represented as a variable with a predetermined name within a TypeScript file.
Within my VS Code extension, I retrieve the document as a string:
const doc = vscode.window.activeTextEditor?.document;
I am trying to figure out the best way to extract the value of the variable from this string. I considered using an Abstract Syntax Tree (AST), but perhaps there is a more straightforward solution available.