## Summary - The `eventide` dep was renamed to [kotatsu](https://github.com/clice-io/kotatsu) with a broad rename of CMake identifiers, namespaces, header paths, and a few module reorgs (`serde` → `codec`, `reflection` → `meta`, `common` → `support`). Align clice to the new names. - CMake: FetchContent target, option prefix (`ETD_*` → `KOTA_*`, `ETD_SERDE_*` → `KOTA_CODEC_*`), target names (`eventide::{ipc::lsp,serde::toml,deco,zest}` → `kota::{ipc::lsp,codec::toml,deco,zest}`). - Namespaces: `eventide::` → `kota::`, `eventide::serde::` → `kota::codec::`, `eventide::refl::` → `kota::meta::`. The short `et` alias is dropped — all usages now spell `kota::` directly. - Headers: `eventide/*` → `kota/*`, including special cases `serde/serde/raw_value.h` → `codec/raw_value.h`, `ipc/json_codec.h` → `ipc/codec/json.h`, `common/meta.h` → `support/type_traits.h`, `common/ranges.h` → `support/ranges.h`. - Kotatsu split `JsonPeer` / `BincodePeer` out of `ipc/peer.h` into the codec-specific headers; added `kota/ipc/codec/{json,bincode}.h` includes where those types are used. - Depends on clice-io/kotatsu#110 (already merged) to prevent `-Wall -Wextra -Werror` from transitively propagating out of `kota::project_options`. ## Test plan - [x] `pixi run unit-test RelWithDebInfo` — 518/518 pass (9 skipped, unchanged from main) - [x] `pixi run integration-test RelWithDebInfo` — 119/119 pass - [x] `pixi run smoke-test RelWithDebInfo` — 2/2 pass - [x] `pixi run format` clean ## Notes - `tests/smoke/rapid_edit.jsonl` was intentionally left untouched: the embedded `#include "eventide/..."` strings are frozen snapshots of file contents the client sent at record time, not clice source. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated internal dependencies from `eventide` to `kota`, including async runtime, IPC transport, serialization codec, and metadata libraries. * Updated build configuration and CMake variables to align with the new dependency. * **Refactor** * Migrated internal implementation to use `kota` namespace and APIs throughout the codebase. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
144 lines
3.0 KiB
C++
144 lines
3.0 KiB
C++
#include <vector>
|
|
|
|
#include "test/test.h"
|
|
#include "test/tester.h"
|
|
#include "feature/feature.h"
|
|
#include "support/filesystem.h"
|
|
|
|
namespace clice::testing {
|
|
|
|
namespace {
|
|
|
|
namespace protocol = kota::ipc::protocol;
|
|
|
|
TEST_SUITE(DocumentLink, Tester) {
|
|
|
|
std::vector<protocol::DocumentLink> links;
|
|
|
|
void run(llvm::StringRef source, llvm::StringRef standard = "-std=c++17") {
|
|
add_files("main.cpp", source);
|
|
ASSERT_TRUE(compile(standard));
|
|
links = feature::document_links(*unit, feature::PositionEncoding::UTF8);
|
|
}
|
|
|
|
auto to_local_range(const protocol::Range& range) -> LocalSourceRange {
|
|
feature::PositionMapper converter(unit->interested_content(), feature::PositionEncoding::UTF8);
|
|
return LocalSourceRange(*converter.to_offset(range.start), *converter.to_offset(range.end));
|
|
}
|
|
|
|
void EXPECT_LINK(std::size_t index, llvm::StringRef name, llvm::StringRef path) {
|
|
auto& link = links[index];
|
|
auto expected = range(name, "main.cpp");
|
|
auto actual = to_local_range(link.range);
|
|
|
|
ASSERT_EQ(actual.begin, expected.begin);
|
|
ASSERT_EQ(actual.end, expected.end);
|
|
ASSERT_TRUE(link.target.has_value());
|
|
|
|
llvm::SmallString<128> target(link.target->begin(), link.target->end());
|
|
path::remove_dots(target);
|
|
ASSERT_EQ(target, path);
|
|
}
|
|
|
|
TEST_CASE(Include) {
|
|
run(R"cpp(
|
|
#[test.h]
|
|
|
|
#[pragma_once.h]
|
|
#pragma once
|
|
|
|
#[guard_macro.h]
|
|
#ifndef TEST3_H
|
|
#define TEST3_H
|
|
#endif
|
|
|
|
#[main.cpp]
|
|
#include @0["test.h"$]
|
|
#include @1["test.h"$]
|
|
#include @2["pragma_once.h"$]
|
|
#include @3["pragma_once.h"$]
|
|
#include @4["guard_macro.h"$]
|
|
#include @5["guard_macro.h"$]
|
|
)cpp");
|
|
|
|
ASSERT_EQ(links.size(), 6U);
|
|
EXPECT_LINK(0, "0", TestVFS::path("test.h"));
|
|
EXPECT_LINK(1, "1", TestVFS::path("test.h"));
|
|
EXPECT_LINK(2, "2", TestVFS::path("pragma_once.h"));
|
|
EXPECT_LINK(3, "3", TestVFS::path("pragma_once.h"));
|
|
EXPECT_LINK(4, "4", TestVFS::path("guard_macro.h"));
|
|
EXPECT_LINK(5, "5", TestVFS::path("guard_macro.h"));
|
|
}
|
|
|
|
TEST_CASE(HasInclude) {
|
|
run(R"cpp(
|
|
#[test.h]
|
|
|
|
#[main.cpp]
|
|
#include @0["test.h"]
|
|
|
|
#if __has_include(@1["test.h"])
|
|
#endif
|
|
|
|
#if __has_include("test2.h")
|
|
#endif
|
|
)cpp");
|
|
|
|
ASSERT_EQ(links.size(), 2U);
|
|
EXPECT_LINK(0, "0", TestVFS::path("test.h"));
|
|
EXPECT_LINK(1, "1", TestVFS::path("test.h"));
|
|
}
|
|
|
|
TEST_CASE(MacroInclude) {
|
|
run(R"cpp(
|
|
#[test.h]
|
|
|
|
#[main.cpp]
|
|
#define HEADER "test.h"
|
|
#include @0[HEADER$]
|
|
)cpp");
|
|
|
|
ASSERT_EQ(links.size(), 1U);
|
|
EXPECT_LINK(0, "0", TestVFS::path("test.h"));
|
|
}
|
|
|
|
TEST_CASE(Embed) {
|
|
run(R"cpp(
|
|
#[bytes.bin]
|
|
0123456789
|
|
|
|
#[main.cpp]
|
|
const char e[] = {
|
|
#embed @0["bytes.bin"$]
|
|
};
|
|
)cpp",
|
|
"-std=c++23");
|
|
|
|
ASSERT_EQ(links.size(), 1U);
|
|
EXPECT_LINK(0, "0", TestVFS::path("bytes.bin"));
|
|
}
|
|
|
|
TEST_CASE(HasEmbed) {
|
|
run(R"cpp(
|
|
#[data.bin]
|
|
ABCDE
|
|
|
|
#[main.cpp]
|
|
#if __has_embed(@0["data.bin"$])
|
|
#endif
|
|
|
|
#if __has_embed("non_existent.bin")
|
|
#endif
|
|
)cpp",
|
|
"-std=c++23");
|
|
|
|
ASSERT_EQ(links.size(), 1U);
|
|
EXPECT_LINK(0, "0", TestVFS::path("data.bin"));
|
|
}
|
|
|
|
}; // TEST_SUITE(DocumentLink)
|
|
|
|
} // namespace
|
|
|
|
} // namespace clice::testing
|