mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 16:15:07 +00:00
Restore include completion on #
This commit is contained in:
parent
6d42b40319
commit
3f5e34ef20
@ -115,7 +115,7 @@ ParseIncludeLineResult ParseIncludeLine(const std::string& line) {
|
||||
"(.*)"); // [7]: suffix after quote char
|
||||
std::smatch match;
|
||||
bool ok = std::regex_match(line, match, pattern);
|
||||
std::string text = match[6].str();
|
||||
std::string text = match[3].str() + match[6].str();
|
||||
return {ok, text, match};
|
||||
}
|
||||
|
||||
@ -298,33 +298,30 @@ struct TextDocumentCompletionHandler : MessageHandler {
|
||||
Out_TextDocumentComplete out;
|
||||
out.id = request->id;
|
||||
|
||||
std::string text = result.match[3];
|
||||
if (std::string_view("include").compare(0, text.size(), text) == 0) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(
|
||||
include_complete->completion_items_mutex, std::defer_lock);
|
||||
if (include_complete->is_scanning)
|
||||
lock.lock();
|
||||
std::string quote = result.match[5];
|
||||
for (auto& item : include_complete->completion_items)
|
||||
if (quote.empty() || quote == (item.use_angle_brackets_ ? "<" : "\""))
|
||||
out.result.items.push_back(item);
|
||||
}
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(
|
||||
include_complete->completion_items_mutex, std::defer_lock);
|
||||
if (include_complete->is_scanning)
|
||||
lock.lock();
|
||||
std::string quote = result.match[5];
|
||||
for (auto& item : include_complete->completion_items)
|
||||
if (quote.empty() || quote == (item.use_angle_brackets_ ? "<" : "\""))
|
||||
out.result.items.push_back(item);
|
||||
}
|
||||
|
||||
// Needed by |FilterAndSortCompletionResponse|.
|
||||
for (lsCompletionItem& item : out.result.items)
|
||||
item.filterText = item.label;
|
||||
// Needed by |FilterAndSortCompletionResponse|.
|
||||
for (lsCompletionItem& item : out.result.items)
|
||||
item.filterText = item.label;
|
||||
|
||||
FilterAndSortCompletionResponse(&out, result.pattern,
|
||||
config->completion.filterAndSort);
|
||||
DecorateIncludePaths(result.match, &out.result.items);
|
||||
FilterAndSortCompletionResponse(&out, result.pattern,
|
||||
config->completion.filterAndSort);
|
||||
DecorateIncludePaths(result.match, &out.result.items);
|
||||
|
||||
for (lsCompletionItem& item : out.result.items) {
|
||||
item.textEdit->range.start.line = request->params.position.line;
|
||||
item.textEdit->range.start.character = 0;
|
||||
item.textEdit->range.end.line = request->params.position.line;
|
||||
item.textEdit->range.end.character = (int)buffer_line.size();
|
||||
}
|
||||
for (lsCompletionItem& item : out.result.items) {
|
||||
item.textEdit->range.start.line = request->params.position.line;
|
||||
item.textEdit->range.start.character = 0;
|
||||
item.textEdit->range.end.line = request->params.position.line;
|
||||
item.textEdit->range.end.character = (int)buffer_line.size();
|
||||
}
|
||||
|
||||
QueueManager::WriteStdout(IpcId::TextDocumentCompletion, out);
|
||||
|
Loading…
Reference in New Issue
Block a user