Update includes when files are renamed
The server advertises willRename and answers workspace/willRenameFiles with a WorkspaceEdit. A bounded core resolves quoted includes against the document directory and replaces only the spelling (relative stays relative, absolute stays absolute, angle includes untouched), with registered tests. EditorDiagnostics converts the byte edits to negotiated positions for every open overlay; a real stdio session returned the extra.hpp -> renamed.hpp edit.
This commit is contained in:
1 parent
158125ace5
commit
b0b48d961c
12 files changed
+277
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vls/features/FileOperations.hpp>
|
||||
#include <vls/features/IncludeUpdate.hpp>
|
||||
#include <vls/semantic/StockCompiler.hpp>
|
||||
|
||||
#include <functional>
|
||||
@@ -20,6 +21,13 @@ class EditorDiagnostics {
|
||||
// Filesystem changes from workspace file-operation notifications. Paths
|
||||
// that changed or disappeared invalidate every dependent analysis context.
|
||||
void files_changed(std::span<const features::file_operations::Change>);
|
||||
struct RenamedFile {
|
||||
std::string old_path, new_path;
|
||||
};
|
||||
// Workspace edit updating quoted includes in open documents that resolve
|
||||
// to a renamed path. Null when nothing would change.
|
||||
[[nodiscard]] Void::LanguageServer::Protocol::Json
|
||||
renamed_files(std::span<const RenamedFile>) const;
|
||||
void begin_update();
|
||||
void finish_update(bool workspace_changed = false);
|
||||
void stop();
|
||||
|
||||
Reference in new issue
Block a user