Skip to content

Latest commit

 

History

History

PHP Parser Syntax Visualizer Tool

Overview

VSCode Extension that demonstrates some of the basic usage and functionality of the parser.

Writes AST to adjacent *.ast file using JSON representation

image

Error Diagnostics from AST

image

Install from VSIX

  1. Download the VSIX, and load into VS Code by running code --install-extension <my-vsix-path> or by selecting Install from VSIX... from the Command Palette (Ctrl+Shift+P). image

  2. Open a folder with some PHP files

  3. Edit the file - you'll see an adjacent *.ast file will appear. Additionally, you should see error squigglies if there are any errors in the file.

  4. The AST will be updated every time you save the file.

Note: You may need to disable any other PHP language service extensions (no need to them off completely - you can disable them on a per-workspace basis)

  • Set "php.validate.enable": false
  • Disable other PHP language service extensions like Crane and PHP IntelliSense

Build from Source

  1. From syntax-visualizer/server/, run npm install && npm run compile
  2. From syntax-visualizer/client, run npm install && npm run compile
  3. Open syntax-visualizer/client in VS Code, and press F5 to launch the extension in the debugger.
    • This will open a new instance of VS Code with the extension loaded

When running in this configuration, any changes you make to the parser will be immediately reflected in the extension (which makes it super handy for debugging any failing tests in the parser.)