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

Method first_file_namespace

src/util.rs:1666–1672  ·  view source on GitHub ↗

Return the first namespace declared in a file. For single-namespace files this is the file's namespace. For multi-namespace files this returns the first block's namespace, which may not be correct for all positions in the file. Prefer [`namespace_at_offset`](Self::namespace_at_offset) when a cursor position is available.

(&self, uri: &str)

Source from the content-addressed store, hash-verified

1664 /// [`namespace_at_offset`](Self::namespace_at_offset) when a cursor
1665 /// position is available.
1666 pub(crate) fn first_file_namespace(&self, uri: &str) -> Option<String> {
1667 self.file_namespaces
1668 .read()
1669 .get(uri)
1670 .and_then(|spans| spans.first())
1671 .and_then(|s| s.namespace.clone())
1672 }
1673
1674 /// Return the import table (short name → FQN) for a file.
1675 ///

Calls 3

cloneMethod · 0.80
getMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected