2017-06-15 05:32:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "language_server_api.h"
|
|
|
|
|
2018-01-31 08:35:04 +00:00
|
|
|
#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|.
|
2018-01-31 08:35:04 +00:00
|
|
|
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.
|
2018-01-31 08:35:04 +00:00
|
|
|
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
|
|
|
|
2017-06-16 02:28:49 +00:00
|
|
|
std::string LexWordAroundPos(lsPosition position, const std::string& content);
|
|
|
|
|
2018-01-20 21:15:43 +00:00
|
|
|
// Case-insensitive subsequence matching.
|
2018-01-31 08:35:04 +00:00
|
|
|
bool SubsequenceMatch(std::string_view search, std::string_view content);
|