Implement text document sync (#119)

This commit is contained in:
ykiko
2025-04-11 22:22:23 +08:00
committed by GitHub
parent 3f96d45ab4
commit 7874fbacb8
23 changed files with 744 additions and 276 deletions

View File

@@ -3,6 +3,7 @@
#include <vector>
#include <cstdint>
#include "AST/SourceCode.h"
#include "llvm/ADT/StringRef.h"
namespace clice {
@@ -17,9 +18,56 @@ struct CodeCompletionOption {};
namespace feature {
struct CodeCompletionItem {};
enum class CompletionItemKind {
None = 0,
Text,
Method,
Function,
Constructor,
Field,
Variable,
Class,
Interface,
Module,
Property,
Unit,
Value,
Enum,
Keyword,
Snippet,
Color,
File,
Reference,
Folder,
EnumMember,
Constant,
Struct,
Event,
Operator,
TypeParameter
};
using CodeCompletionResult = std::vector<CodeCompletionItem>;
struct CompletionItem {
/// The label displayed when user select the item.
std::string label;
std::string detail;
/// TODO:
/// std::string sortText;
CompletionItemKind kind;
bool deprecated;
struct Edit {
std::string text;
LocalSourceRange range;
} edit;
};
using CodeCompletionResult = std::vector<CompletionItem>;
CodeCompletionResult codeCompletion(CompilationParams& params,
const config::CodeCompletionOption& option);