Files
whetstone_DSL/editor/src/LSPWorkspaceIndex.h
Bill 67c3c73046 Sprint 277: LSP Advanced Orchestration (steps 1913-1917)
- LSPWorkspaceIndex: track open docs, URI→{languageId,content,version}
- LSPDiagnosticsAggregator: merge diagnostics from multiple LSP sources per URI
- LSPCompletionMerger: merge+deduplicate completion items from multiple sources
- LSPOrchestrator: top-level coordinator composing all three + proxy + cross-lang resolver
- Sprint277IntegrationSummary: poly-api (Go+TypeScript) end-to-end integration

26/26 tests passing (5+5+5+5+6). All new headers ≤600 lines.
LoRA recorded: sprint277-2026-03-01 (1 call, 569 tokens).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 20:18:23 -07:00

73 lines
1.9 KiB
C++

#pragma once
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <vector>
namespace whetstone {
struct DocumentInfo {
std::string uri;
std::string languageId;
std::string content;
int version = 0;
};
class LSPWorkspaceIndex {
public:
void open(const std::string& uri, const std::string& languageId,
const std::string& content, int version) {
docs_[uri] = DocumentInfo{uri, languageId, content, version};
}
void update(const std::string& uri, const std::string& content, int version) {
auto it = docs_.find(uri);
if (it == docs_.end()) return;
it->second.content = content;
it->second.version = version;
}
void close(const std::string& uri) {
docs_.erase(uri);
}
bool contains(const std::string& uri) const {
return docs_.count(uri) > 0;
}
std::string getLanguage(const std::string& uri) const {
auto it = docs_.find(uri);
if (it == docs_.end()) return "";
return it->second.languageId;
}
DocumentInfo getDocument(const std::string& uri) const {
auto it = docs_.find(uri);
if (it == docs_.end()) return {};
return it->second;
}
std::vector<std::string> listUris(const std::string& languageId) const {
std::vector<std::string> result;
for (const auto& [uri, info] : docs_)
if (info.languageId == languageId)
result.push_back(uri);
return result;
}
std::vector<std::string> allLanguages() const {
std::set<std::string> langs;
for (const auto& [uri, info] : docs_)
langs.insert(info.languageId);
return {langs.begin(), langs.end()};
}
int size() const { return static_cast<int>(docs_.size()); }
private:
std::map<std::string, DocumentInfo> docs_;
};
} // namespace whetstone