mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
01c70368e3
* lsp: json-rpc example is working, a decent place to start... * lsp: vendor library * lsp: cleanup and time to get started * lsp: commit what i got so far * lsp: example `initialize` payload * lsp: switch to `stdio` * stash * modularize the lsp implementation * lsp: implement first actual LSP feature - function names in outline * lsp: produce document diagnostics * lsp: remove unused third-party lib * lsp: support hovering MIPS instructions in IR files * lsp: basic go-to all-types definition * stash * lsp: cleanup code, just need to add it to the release artifacts * fix some project configuration * fix linux build * lsp: add lsp to PR artifacts and release assets * lsp: address feedback
26 lines
621 B
C++
26 lines
621 B
C++
#include <optional>
|
|
|
|
#include "lsp/protocol/common_types.h"
|
|
#include "lsp/state/workspace.h"
|
|
|
|
#include "third-party/json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
std::optional<json> document_symbols_handler(Workspace& workspace, int id, json params) {
|
|
auto converted_params = params.get<LSPSpec::DocumentSymbolParams>();
|
|
auto tracked_file = workspace.get_tracked_ir_file(converted_params.m_textDocument.m_uri);
|
|
|
|
if (!tracked_file) {
|
|
return {};
|
|
}
|
|
|
|
// TODO - convert to type!
|
|
|
|
json arr = json::array();
|
|
for (const auto& symbol : tracked_file.value().m_symbols) {
|
|
arr.push_back(symbol);
|
|
}
|
|
return arr;
|
|
}
|