Skip to content

RootDetection

🛈 DocStrings

How to detect project root for LSP.

Parameters:

Name Type Description Default
include_patterns list[str]

File patterns that indicate project root (e.g., ["pyproject.toml"])

required
exclude_patterns list[str] | None

If these are found, skip this LSP (e.g., ["deno.json"] for typescript)

None
workspace_marker str | None

Content marker for workspace detection (e.g., "[workspace]" in Cargo.toml)

None
Source code in src/anyenv/lsp_servers/_base.py
@dataclass
class RootDetection:
    """How to detect project root for LSP.

    Args:
        include_patterns: File patterns that indicate project root (e.g., ["pyproject.toml"])
        exclude_patterns: If these are found, skip this LSP (e.g., ["deno.json"] for typescript)
        workspace_marker: Content marker for workspace detection (e.g., "[workspace]" in Cargo.toml)
    """

    include_patterns: list[str]
    exclude_patterns: list[str] | None = None
    workspace_marker: str | None = None

:fa-brands-github: Show source on GitHub