mirror of
https://github.com/open-goal/jak-project
synced 2026-06-28 11:11:00 -04:00
0e31a9c407
This change adds a few new features: - Decompiler automatically knows the type of `find-parent-method` use in jak 1 and jak2 when used in a method or virtual state handler. - Decompiler inserts a call to `call-parent-method` or `find-parent-state` - Removed most casts related to these functions There are still a few minor issues around this: - There are still some casts needed when using `post` methods, as `post` is just a `function`, and needs a cast to `(function none)` or similar. It didn't seem easy to change the type of `post`, so I'm not going to worry about it for this PR. It only shows up in like 3 places in jak 2. (and 0 in jak 1) - If "call the handler if it's not #f" logic should probably be another macro. Fixes #805
28 lines
639 B
C++
28 lines
639 B
C++
#pragma once
|
|
|
|
#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;
|
|
}
|