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

Function detects_function_context

src/code_actions/extract_function.rs:4406–4413  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4404
4405 #[test]
4406 fn detects_function_context() {
4407 let content = "<?php\nfunction foo() {\n $x = 1;\n}\n";
4408 let offset = content.find("$x").unwrap() as u32;
4409 let ctx = find_enclosing_context(content, offset, false);
4410 assert!(ctx.is_some());
4411 let ctx = ctx.unwrap();
4412 assert_eq!(ctx.target, ExtractionTarget::Function);
4413 }
4414
4415 #[test]
4416 fn detects_method_context() {

Callers

nothing calls this directly

Calls 3

find_enclosing_contextFunction · 0.85
unwrapMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected