compiler: Store an optional version number with the document

A None value means the file on disk is the golden version.

We have an editor, the LSP and the preview that all need to at least
notice when they have newer data then their peers. So IMHO it makes
sense to have an optional document version around.

The language server protocol makes use of a version number already. This
patch moves that code into the compiler so that it is stored with the
actual data getting versioned.
This commit is contained in:
Tobias Hunger 2023-12-05 21:22:01 +01:00 committed by Tobias Hunger
parent dc536ac599
commit d785f2d5df
20 changed files with 116 additions and 52 deletions

View file

@ -22,7 +22,7 @@ use crate::typeregister::TypeRegister;
/// At this point, it really should already contain the basic Types (string, int, ...)
pub(crate) fn load_builtins(register: &mut TypeRegister) {
let mut diag = crate::diagnostics::BuildDiagnostics::default();
let node = crate::parser::parse(include_str!("builtins.slint").into(), None, &mut diag);
let node = crate::parser::parse(include_str!("builtins.slint").into(), None, None, &mut diag);
if !diag.is_empty() {
let vec = diag.to_string_vec();
#[cfg(feature = "display-diagnostics")]