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

Method resolve_remove_ignore

src/code_actions/phpstan/ignore.rs:190–215  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

188 /// Resolve a deferred "Remove unnecessary @phpstan-ignore" code action
189 /// by computing the workspace edit.
190 pub(crate) fn resolve_remove_ignore(
191 &self,
192 data: &CodeActionData,
193 content: &str,
194 ) -> Option<WorkspaceEdit> {
195 let diagnostic_message = data.extra.get("diagnostic_message")?.as_str()?;
196 let diagnostic_line = data.extra.get("diagnostic_line")?.as_u64()? as u32;
197
198 let ignore_id = parse_unmatched_identifier(diagnostic_message);
199 let ignore_line = parse_unmatched_line(diagnostic_message);
200
201 let message_line = ignore_line.unwrap_or(diagnostic_line);
202
203 let edit =
204 build_remove_ignore_edit(content, message_line, diagnostic_line, ignore_id.as_deref())?;
205
206 let doc_uri: Url = data.uri.parse().ok()?;
207 let mut changes = HashMap::new();
208 changes.insert(doc_uri, vec![edit]);
209
210 Some(WorkspaceEdit {
211 changes: Some(changes),
212 document_changes: None,
213 change_annotations: None,
214 })
215 }
216}
217
218/// Build a `TextEdit` that adds a `@phpstan-ignore` comment to a line.

Callers 1

resolve_code_actionMethod · 0.80

Calls 7

parse_unmatched_lineFunction · 0.85
build_remove_ignore_editFunction · 0.85
as_strMethod · 0.80
getMethod · 0.45
parseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected