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>
This commit is contained in:
72
editor/src/LSPWorkspaceIndex.h
Normal file
72
editor/src/LSPWorkspaceIndex.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user