Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/ty/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ typeshed = "/path/to/custom/typeshed"

#### `root`

The root(s) of the project, used for finding first-party modules.
The root of the project, used for finding first-party modules.

**Default value**: `[".", "./src"]`
Copy link
Member

@AlexWaygood AlexWaygood May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it's weird that we default to multiple values if users can't set it to multiple values

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is. Not sure how to fix.

Copy link
Member

@AlexWaygood AlexWaygood May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of referring to a default value, we could say something like

Suggested change
**Default value**: `[".", "./src"]`
**If not set, two first-party roots are inferred by default: `"."` and `"./src"`**

?


**Type**: `list[str]`
**Type**: `str`

**Example usage** (`pyproject.toml`):

```toml
[tool.ty.src]
root = ["./app"]
root = "./app"
```

---
Expand Down
6 changes: 3 additions & 3 deletions crates/ty_project/src/metadata/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,13 @@ pub struct EnvironmentOptions {
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct SrcOptions {
/// The root(s) of the project, used for finding first-party modules.
/// The root of the project, used for finding first-party modules.
#[serde(skip_serializing_if = "Option::is_none")]
#[option(
default = r#"[".", "./src"]"#,
value_type = "list[str]",
value_type = "str",
example = r#"
root = ["./app"]
root = "./app"
"#
)]
pub root: Option<RelativePathBuf>,
Expand Down
2 changes: 1 addition & 1 deletion ty.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@
"type": "object",
"properties": {
"root": {
"description": "The root(s) of the project, used for finding first-party modules.",
"description": "The root of the project, used for finding first-party modules.",
"type": [
"string",
"null"
Expand Down
Loading