mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add support for publishDiagnostics (#4912)
<img width="536" alt="Screenshot 2025-02-06 at 3 02 18 PM" src="https://github.com/user-attachments/assets/27b7673d-f8d4-4f9f-9e5d-20c3a88b8c78" /> Requires the caching work in #4897
This commit is contained in:
@@ -16,8 +16,9 @@ auto HandleDidOpenTextDocument(
|
||||
}
|
||||
|
||||
auto insert_result = context.files().Insert(
|
||||
filename, [&] { return Context::File(filename.str()); });
|
||||
insert_result.value().SetText(context, params.textDocument.text);
|
||||
filename, [&] { return Context::File(params.textDocument.uri); });
|
||||
insert_result.value().SetText(context, params.textDocument.version,
|
||||
params.textDocument.text);
|
||||
if (!insert_result.is_inserted()) {
|
||||
CARBON_DIAGNOSTIC(LanguageServerOpenDuplicateFile, Warning,
|
||||
"duplicate open file request; updating content");
|
||||
@@ -43,7 +44,8 @@ auto HandleDidChangeTextDocument(
|
||||
return;
|
||||
}
|
||||
if (auto* file = context.LookupFile(filename)) {
|
||||
file->SetText(context, params.contentChanges[0].text);
|
||||
file->SetText(context, params.textDocument.version,
|
||||
params.contentChanges[0].text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user