ccls/src/lex_utils.h

33 lines
1.1 KiB
C
Raw Normal View History

2017-06-15 05:32:23 +00:00
#pragma once
#include "language_server_api.h"
#include <string_view.h>
2017-06-15 05:32:23 +00:00
#include <string>
2018-01-29 14:26:13 +00:00
#include <tuple>
2017-06-15 05:32:23 +00:00
// Utility method to map |position| to an offset inside of |content|.
int GetOffsetForPosition(lsPosition position, std::string_view content);
2017-06-15 05:32:23 +00:00
// Utility method to find a position for the given character.
lsPosition CharPos(std::string_view search,
2017-09-22 01:14:57 +00:00
char character,
int character_offset = 0);
2017-06-15 05:32:23 +00:00
2018-01-29 14:26:13 +00:00
std::tuple<bool, std::string, std::string> ShouldRunIncludeCompletion(
const std::string& line);
2017-06-15 05:32:23 +00:00
// TODO: eliminate |line_number| param.
optional<lsRange> ExtractQuotedRange(int line_number, const std::string& line);
2017-09-22 01:14:57 +00:00
void LexFunctionDeclaration(const std::string& buffer_content,
lsPosition declaration_spelling,
optional<std::string> type_name,
std::string* insert_text,
int* newlines_after_name);
2017-06-15 05:32:23 +00:00
std::string LexWordAroundPos(lsPosition position, const std::string& content);
// Case-insensitive subsequence matching.
bool SubsequenceMatch(std::string_view search, std::string_view content);