The diagnostics in solang-vscode are useful to test the code before compiling to ensure the code is correct and compiles.
- Open a solidity file(.sol).
- Make changes in the opened file and save it.
When you open a file the client sends this doc URI to the server. The solang-server uses solang as a backend for solidity, opens the specified file and performs two operations:
- Parsing the file.
- Resolving the AST and returning any errors occured in the process.
The solang-server after recieving the diagnostics performs necessary transforms like conversion of messages to LSP standard types, mapping of the line and coloumn of the messages with the file finally forwarding it to the client.
- Errors.
- Information.
- Warnings.
- Debug/Hints.
Currently the extension comes with 4 diagnostics tests which tests the extension on:
- Coloum, Line alignment of diagnostics with respect to file.
- Checking for correct warnings.
- Checking for correct hint messages from the server.
- Checking for correct error messages from the server.
- Build the extension (Ctrl+Shift+B).
- Press F5 and from the bottom menu select "Extension tests". The result should appear in the debug console.
The server might take a few seconds to respond during file changes. We are working on more features, stay tuned!