Skip to main content

code_actions_for_range

Function code_actions_for_range 

Source
pub fn code_actions_for_range(
    diagnostics: &[Diagnostic],
    range: Range,
    docs: &DashMap<Url, DocState>,
    encoding: PositionEncoding,
    workspace_root: Option<&Path>,
) -> Vec<CodeActionOrCommand>
Expand description

Build LSP CodeActions for every JsonSuggestion attached to diagnostics (via Phase 1’s data field) whose primary range overlaps the requested range.

docs is used to look up LineMaps so we can convert the suggestion’s byte offsets to LSP positions. Falls back to fetching the source from disk if the file isn’t open in the editor.