Implement DocumentLink (#107)
This commit is contained in:
@@ -98,6 +98,8 @@ public:
|
||||
|
||||
async::Task<std::vector<feature::FoldingRange>> foldingRanges(llvm::StringRef file) const;
|
||||
|
||||
async::Task<std::vector<feature::DocumentLink>> documentLinks(llvm::StringRef file) const;
|
||||
|
||||
private:
|
||||
async::Task<> index(std::string file);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Feature/FoldingRange.h"
|
||||
#include "Feature/DocumentSymbol.h"
|
||||
#include "Feature/SemanticTokens.h"
|
||||
#include "Feature/DocumentLink.h"
|
||||
#include "Server/Protocol.h"
|
||||
|
||||
namespace clice {
|
||||
@@ -36,10 +37,15 @@ public:
|
||||
std::vector<proto::FoldingRange> transform(llvm::StringRef content,
|
||||
llvm::ArrayRef<feature::FoldingRange> foldings);
|
||||
|
||||
std::vector<proto::DocumentLink> transform(llvm::StringRef content,
|
||||
llvm::ArrayRef<feature::DocumentLink> links);
|
||||
|
||||
Result convert(llvm::StringRef path, llvm::ArrayRef<feature::SemanticToken> tokens);
|
||||
|
||||
Result convert(llvm::StringRef path, llvm::ArrayRef<feature::FoldingRange> foldings);
|
||||
|
||||
Result convert(llvm::StringRef path, llvm::ArrayRef<feature::DocumentLink> links);
|
||||
|
||||
Result convert(const feature::Hover& hover);
|
||||
|
||||
private:
|
||||
|
||||
@@ -289,6 +289,11 @@ enum class FoldingRangeKind {
|
||||
Region,
|
||||
};
|
||||
|
||||
struct DocumentLink {
|
||||
Range range;
|
||||
URI target;
|
||||
};
|
||||
|
||||
/// Represents a folding range. To be valid, start and end line must be bigger
|
||||
/// than zero and smaller than the number of lines in the document. Clients
|
||||
/// are free to ignore invalid ranges.
|
||||
@@ -366,6 +371,14 @@ struct ServerCapabilities {
|
||||
/// The server provides semantic tokens support.
|
||||
SemanticTokensOptions semanticTokensProvider;
|
||||
|
||||
struct DocumentLinkOptions {
|
||||
/// Document links have a resolve provider as well.
|
||||
bool resolveProvider = false;
|
||||
};
|
||||
|
||||
/// The server provides document link support.
|
||||
DocumentLinkOptions documentLinkProvider;
|
||||
|
||||
/// The server provides folding provider support.
|
||||
bool foldingRangeProvider = true;
|
||||
};
|
||||
@@ -425,6 +438,8 @@ using SemanticTokensParams = TextDocumentParams;
|
||||
|
||||
using FoldingRangeParams = TextDocumentParams;
|
||||
|
||||
using DocumentLinkParams = TextDocumentParams;
|
||||
|
||||
struct HeaderContext {
|
||||
/// The path of context file.
|
||||
std::string file;
|
||||
|
||||
Reference in New Issue
Block a user