Serve document symbols and highlights over LSP
SymbolIndex::find_by_path exposes one document's records with the same overlay shadowing and coverage as find. EditorDiagnostics maps them to textDocument/documentSymbol, and a bounded same-file highlight core (vls/features/DocumentSymbols.hpp) backs textDocument/documentHighlight from verified occurrence facts with the ambiguous-binding rule. Both are advertised and exercised over a real stdio session with the stock observer. Record the LSP parity matrix.
This commit is contained in:
1 parent
da8003f6d4
commit
8ca3dcbf74
16 files changed
+366
-8
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <compare>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace vls::features::documents {
|
||||
|
||||
struct Position {
|
||||
std::uint32_t line{}, character{};
|
||||
auto operator<=>(const Position &) const = default;
|
||||
};
|
||||
|
||||
struct Range {
|
||||
Position start, end;
|
||||
auto operator<=>(const Range &) const = default;
|
||||
};
|
||||
|
||||
struct Location {
|
||||
std::string path;
|
||||
Range range;
|
||||
auto operator<=>(const Location &) const = default;
|
||||
};
|
||||
|
||||
// Semantic identity of one binding, joined by definition like navigation.
|
||||
struct Binding {
|
||||
std::string name;
|
||||
std::optional<Location> definition;
|
||||
auto operator<=>(const Binding &) const = default;
|
||||
};
|
||||
|
||||
struct Use {
|
||||
Binding binding;
|
||||
std::string path;
|
||||
Range range;
|
||||
};
|
||||
|
||||
// Ranges of every proven use of the binding at the position, restricted to
|
||||
// the same file, deduplicated and bounded. An empty result means no unique
|
||||
// binding covers the position.
|
||||
[[nodiscard]] std::vector<Range> highlights(std::span<const Use>, std::string_view path, Position,
|
||||
std::size_t limit = 512);
|
||||
|
||||
} // namespace vls::features::documents
|
||||
Reference in new issue
Block a user