MCPcopy Create free account
hub / github.com/clice-io/clice / code_complete

Function code_complete

tests/unit/feature/code_completion_tests.cpp:20–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18std::string main_path;
19
20void code_complete(llvm::StringRef code, feature::CodeCompletionOptions options = {}) {
21 vfs = llvm::makeIntrusiveRefCnt<TestVFS>();
22
23 CompilationParams params;
24 auto annotation = AnnotatedSource::from(code);
25
26 vfs->add("main.cpp", annotation.content);
27 params.vfs = vfs;
28 main_path = TestVFS::path("main.cpp");
29 params.arguments =
30 {"clang++", "-std=c++20", "-ffreestanding", "-Xclang", "-undef", main_path.c_str()};
31 params.completion = {main_path, annotation.offsets.lookup("pos")};
32 params.add_remapped_file(main_path, annotation.content);
33
34 items = feature::code_complete(params, options, feature::PositionEncoding::UTF8);
35}
36
37auto find_item(llvm::StringRef label) {
38 return std::ranges::find_if(items, [&](const protocol::CompletionItem& item) {

Callers 1

TEST_CASEFunction · 0.70

Calls 3

add_remapped_fileMethod · 0.80
addMethod · 0.45
lookupMethod · 0.45

Tested by

no test coverage detected