Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/feature/code_completion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ class CodeCompletionCollector final : public clang::CodeCompleteConsumer {

PositionMapper converter(content, encoding);
auto replace_range = protocol::Range{
.start = converter.to_position(prefix.range.begin),
.end = converter.to_position(prefix.range.end),
.start = *converter.to_position(prefix.range.begin),
.end = *converter.to_position(prefix.range.end),
};

std::vector<protocol::CompletionItem> collected;
Expand Down
4 changes: 2 additions & 2 deletions src/feature/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ auto diagnostics(CompilationUnitRef unit, PositionEncoding encoding)
auto offset = unit.file_offset(include_location);
auto end_offset = offset + unit.token_spelling(include_location).size();
diagnostic.range = protocol::Range{
.start = main_converter.to_position(offset),
.end = main_converter.to_position(end_offset),
.start = *main_converter.to_position(offset),
.end = *main_converter.to_position(end_offset),
};

current = std::move(diagnostic);
Expand Down
4 changes: 2 additions & 2 deletions src/feature/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ using eventide::ipc::lsp::parse_position_encoding;

inline auto to_range(const PositionMapper& converter, LocalSourceRange range) -> protocol::Range {
return protocol::Range{
.start = converter.to_position(range.begin),
.end = converter.to_position(range.end),
.start = *converter.to_position(range.begin),
.end = *converter.to_position(range.end),
};
}

Expand Down
4 changes: 2 additions & 2 deletions src/feature/folding_ranges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ auto folding_ranges(CompilationUnitRef unit, PositionEncoding encoding)
result.reserve(collected.size());

for(const auto& item: collected) {
auto start = converter.to_position(item.range.begin);
auto end = converter.to_position(item.range.end);
auto start = *converter.to_position(item.range.begin);
auto end = *converter.to_position(item.range.end);

protocol::FoldingRange range{
.start_line = start.line,
Expand Down
4 changes: 2 additions & 2 deletions src/feature/formatting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ auto document_format(llvm::StringRef file,

for(const auto& replacement: *replacements) {
protocol::TextEdit edit;
edit.range.start = converter.to_position(replacement.getOffset());
edit.range.end = converter.to_position(replacement.getOffset() + replacement.getLength());
edit.range.start = *converter.to_position(replacement.getOffset());
edit.range.end = *converter.to_position(replacement.getOffset() + replacement.getLength());
edit.new_text = replacement.getReplacementText().str();
edits.push_back(std::move(edit));
}
Expand Down
4 changes: 2 additions & 2 deletions src/feature/hover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ auto hover_range(CompilationUnitRef unit,
}

return protocol::Range{
.start = converter.to_position(range.begin),
.end = converter.to_position(range.end),
.start = *converter.to_position(range.begin),
.end = *converter.to_position(range.end),
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/feature/inlay_hints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ auto inlay_hints(CompilationUnitRef unit,

for(const auto& hint: raw_hints) {
protocol::InlayHint out{
.position = converter.to_position(hint.offset),
.position = *converter.to_position(hint.offset),
.label = hint.label,
};

Expand Down
4 changes: 2 additions & 2 deletions src/feature/semantic_tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ class SemanticTokenEncoder {

auto begin = token.range.begin;
auto end = token.range.end;
auto begin_position = converter.to_position(begin);
auto end_position = converter.to_position(end);
auto begin_position = *converter.to_position(begin);
auto end_position = *converter.to_position(end);
auto begin_line = static_cast<std::uint32_t>(begin_position.line);
auto begin_char = static_cast<std::uint32_t>(begin_position.character);
auto end_line = static_cast<std::uint32_t>(end_position.line);
Expand Down
Loading
Loading