Skip to main content

add_to_context

Function add_to_context 

Source
pub fn add_to_context(
    source: &str,
    rope: &LineIndex,
    entry: ContextEntry<'_>,
) -> Option<Vec<TextEdit>>
Expand description

Returns a TextEdit that inserts entry into the @context of the JSON-LD document described by source / rope. Returns None when:

  • the entry (prefix key or URL string) is already present, or
  • the existing value shape cannot be extended.

When no @context key exists yet, a new one is inserted right after the opening { of the top-level JSON object.