LSP: Rework management of client owned files
This commit is contained in:
@@ -54,6 +54,17 @@
|
||||
|
||||
#include "thirdparty/doctest/doctest.h"
|
||||
|
||||
class TestGDScriptLanguageProtocolInitializer {
|
||||
public:
|
||||
static void setup_client() {
|
||||
GDScriptLanguageProtocol *proto = GDScriptLanguageProtocol::get_singleton();
|
||||
Ref<GDScriptLanguageProtocol::LSPeer> peer = memnew(GDScriptLanguageProtocol::LSPeer);
|
||||
proto->clients.insert(proto->next_client_id, peer);
|
||||
proto->latest_client_id = proto->next_client_id;
|
||||
proto->next_client_id++;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct doctest::StringMaker<LSP::Position> {
|
||||
static doctest::String convert(const LSP::Position &p_val) {
|
||||
@@ -96,6 +107,7 @@ GDScriptLanguageProtocol *initialize(const String &p_root) {
|
||||
init_language(absolute_root);
|
||||
|
||||
GDScriptLanguageProtocol *proto = memnew(GDScriptLanguageProtocol);
|
||||
TestGDScriptLanguageProtocolInitializer::setup_client();
|
||||
|
||||
Ref<GDScriptWorkspace> workspace = GDScriptLanguageProtocol::get_singleton()->get_workspace();
|
||||
workspace->root = absolute_root;
|
||||
@@ -502,8 +514,7 @@ func f():
|
||||
|
||||
for (const String &path : paths) {
|
||||
assert_no_errors_in(path);
|
||||
GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_local_script(path);
|
||||
ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_results[path];
|
||||
ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_parse_result(path);
|
||||
REQUIRE(parser);
|
||||
LSP::DocumentSymbol cls = parser->get_symbols();
|
||||
|
||||
@@ -515,8 +526,7 @@ func f():
|
||||
SUBCASE("Documentation is correctly set") {
|
||||
String path = "res://lsp/doc_comments.gd";
|
||||
assert_no_errors_in(path);
|
||||
GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_local_script(path);
|
||||
ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_results[path];
|
||||
ExtendGDScriptParser *parser = GDScriptLanguageProtocol::get_singleton()->get_parse_result(path);
|
||||
REQUIRE(parser);
|
||||
LSP::DocumentSymbol cls = parser->get_symbols();
|
||||
REQUIRE(cls.documentation.contains("brief"));
|
||||
|
||||
Reference in New Issue
Block a user