MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / byte_range_to_lsp_range

Function byte_range_to_lsp_range

src/util.rs:476–483  ·  view source on GitHub ↗

Convert a byte offset range to an LSP `Range`. Returns a `Range` with both endpoints converted from byte offsets to `Position` (line/character).

(content: &str, start: usize, end: usize)

Source from the content-addressed store, hash-verified

474/// Returns a `Range` with both endpoints converted from byte offsets
475/// to `Position` (line/character).
476pub(crate) fn byte_range_to_lsp_range(content: &str, start: usize, end: usize) -> Range {
477 let start_pos = offset_to_position(content, start);
478 let end_pos = offset_to_position(content, end);
479 Range {
480 start: start_pos,
481 end: end_pos,
482 }
483}
484
485/// Strip trailing PHP visibility/modifier keywords from a string.
486///

Callers 11

highlight_variableMethod · 0.85
highlight_thisMethod · 0.85
highlight_classMethod · 0.85
highlight_member_nameMethod · 0.85
highlight_functionMethod · 0.85
highlight_constantMethod · 0.85
highlight_keywordMethod · 0.85

Calls 1

offset_to_positionFunction · 0.85

Tested by

no test coverage detected