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

Method resolve_add_ignore

src/code_actions/phpstan/ignore.rs:165–186  ·  view source on GitHub ↗

Resolve a deferred "Add @phpstan-ignore" code action by computing the workspace edit.

(
        &self,
        data: &CodeActionData,
        content: &str,
    )

Source from the content-addressed store, hash-verified

163 /// Resolve a deferred "Add @phpstan-ignore" code action by computing
164 /// the workspace edit.
165 pub(crate) fn resolve_add_ignore(
166 &self,
167 data: &CodeActionData,
168 content: &str,
169 ) -> Option<WorkspaceEdit> {
170 let identifier = data.extra.get("identifier")?.as_str()?;
171 let line = data.extra.get("line")?.as_u64()? as u32;
172
173 let line_text = content.lines().nth(line as usize)?;
174
175 let edit = build_add_ignore_edit(content, line, line_text, identifier);
176
177 let doc_uri: Url = data.uri.parse().ok()?;
178 let mut changes = HashMap::new();
179 changes.insert(doc_uri, vec![edit]);
180
181 Some(WorkspaceEdit {
182 changes: Some(changes),
183 document_changes: None,
184 change_annotations: None,
185 })
186 }
187
188 /// Resolve a deferred "Remove unnecessary @phpstan-ignore" code action
189 /// by computing the workspace edit.

Callers 1

resolve_code_actionMethod · 0.80

Calls 5

build_add_ignore_editFunction · 0.85
as_strMethod · 0.80
getMethod · 0.45
parseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected