LLVM 22.0.0git
|
#include "llvm/Support/LSP/Protocol.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
Go to the source code of this file.
Functions | |
template<typename T> | |
static bool | mapOptOrNull (const llvm::json::Value &Params, llvm::StringLiteral Prop, T &Out, llvm::json::Path Path) |
static bool | isWindowsPath (StringRef Path) |
static bool | isNetworkPath (StringRef Path) |
static bool | shouldEscapeInURI (unsigned char C) |
static void | percentEncode (StringRef Content, std::string &Out) |
Encodes a string according to percent-encoding. | |
static std::string | percentDecode (StringRef Content) |
Decodes a string according to percent-encoding. | |
static StringSet & | getSupportedSchemes () |
Return the set containing the supported URI schemes. | |
static bool | isStructurallyValidScheme (StringRef Scheme) |
Returns true if the given scheme is structurally valid, i.e. | |
static llvm::Expected< std::string > | uriFromAbsolutePath (StringRef AbsolutePath, StringRef Scheme) |
static llvm::Expected< std::string > | getAbsolutePath (StringRef Authority, StringRef Body) |
static llvm::Expected< std::string > | parseFilePathFromURI (StringRef OrigUri) |
static llvm::StringRef | toTextKind (MarkupKind Kind) |
|
static |
Definition at line 162 of file Protocol.cpp.
References llvm::StringRef::consume_front(), llvm::createStringError(), llvm::StringRef::empty(), llvm::inconvertibleErrorCode(), isWindowsPath(), llvm::sys::path::native, llvm::StringRef::starts_with(), and llvm::StringRef::substr().
Referenced by parseFilePathFromURI().
|
static |
Return the set containing the supported URI schemes.
Definition at line 115 of file Protocol.cpp.
Referenced by parseFilePathFromURI(), and llvm::lsp::URIForFile::registerSupportedScheme().
Definition at line 54 of file Protocol.cpp.
References llvm::sys::path::is_separator().
Referenced by uriFromAbsolutePath().
Returns true if the given scheme is structurally valid, i.e.
it does not contain any invalid scheme characters. This does not check that the scheme is actually supported.
Definition at line 123 of file Protocol.cpp.
References llvm::all_of(), llvm::CallingConv::C, llvm::drop_begin(), llvm::StringRef::empty(), llvm::isAlnum(), and llvm::isAlpha().
Referenced by parseFilePathFromURI().
Definition at line 50 of file Protocol.cpp.
References llvm::isAlpha().
Referenced by getAbsolutePath(), and uriFromAbsolutePath().
|
static |
Definition at line 27 of file Protocol.cpp.
References assert(), llvm::lsp::fromJSON(), llvm::json::Value::getAsObject(), and T.
Referenced by llvm::lsp::fromJSON(), llvm::lsp::fromJSON(), and llvm::lsp::fromJSON().
|
static |
Definition at line 183 of file Protocol.cpp.
References llvm::StringRef::consume_front(), contains(), llvm::createStringError(), llvm::StringRef::find(), getAbsolutePath(), getSupportedSchemes(), llvm::inconvertibleErrorCode(), isStructurallyValidScheme(), llvm::StringRef::npos, percentDecode(), and llvm::StringRef::substr().
Referenced by llvm::lsp::URIForFile::fromURI().
|
static |
Decodes a string according to percent-encoding.
Definition at line 96 of file Protocol.cpp.
References llvm::StringRef::begin(), E(), llvm::StringRef::end(), llvm::hexFromNibbles(), I, and llvm::isHexDigit().
Referenced by parseFilePathFromURI().
|
static |
Encodes a string according to percent-encoding.
Definition at line 83 of file Protocol.cpp.
References llvm::CallingConv::C, llvm::hexdigit(), and shouldEscapeInURI().
Referenced by uriFromAbsolutePath().
Definition at line 59 of file Protocol.cpp.
References llvm::CallingConv::C.
Referenced by percentEncode().
|
static |
Definition at line 563 of file Protocol.cpp.
References llvm_unreachable, llvm::lsp::Markdown, and llvm::lsp::PlainText.
Referenced by llvm::lsp::operator<<(), and llvm::lsp::toJSON().
|
static |
Definition at line 133 of file Protocol.cpp.
References llvm::StringRef::consume_front(), llvm::sys::path::convert_to_slash(), llvm::StringRef::drop_front(), llvm::StringRef::empty(), isNetworkPath(), isWindowsPath(), percentEncode(), llvm::sys::path::root_name(), starts_with(), and llvm::StringRef::str().
Referenced by llvm::lsp::URIForFile::fromFile().