Overlap Between Validator and LSP Server - DevOps-MBSE/AaC GitHub Wiki

There is a user/service-provider relationship between the functionality provided by the Architecture-as-Code (AaC) Validator and the Language Server Protocol Server. The purpose of this document is to propose a path forward for combining these two components such that they can be used effectively together to provide the most value for our users.

Validator

The main purpose of the validator is to ensure one or more AaC models adhere to the AaC grammar as defined in the spec.

LSP Server

While the validator is responsible for confirming the correctness (according to the AaC spec) of one, or more, models, the purpose of the LSP server is to provide intelligent language capabilities for one or more software clients that understand how to make use of the information provided by it.

Currently, the only client we have started development on is VSCode, but LSP is client-agnostic so many more clients could be created that provide the necessary features.

How they work together

As of the time of this writing, the only interaction interface a user can have with the validator is to run it from the command line. This is likely sufficient for adequately technical users, but for those who don't regularly spend time in the command line, it is not an acceptable solution. This leads to the need for an integrated solution where a non-technical user can create and validate their system models without the need to touch a terminal. To address this need, we can use the LSP to validate models and provide validation results to the user via "validation errors" akin to what they would get from a spell checking tool. We will achieve this by using the LSP client to send the currently active model(s) to the LSP server which will delegate validation to the validator. Once complete, the server will return any validation errors/warnings (once we have validation warnings) to the LSP client via a textDocument/publishDiagnostics notification. After which, the client is responsible for presenting those errors/warnings to the user.