Skip to content

Commit

Permalink
feat(workspace): support object config (#24483)
Browse files Browse the repository at this point in the history
This adds object config for the workspace config:

```json
{
  "workspace": {
    "members": ["./member-1", "./member-2"]
  }
}
```

This is a more verbose version of `"workspace": ["./member-1",
"./member-2"]`. Although we don't need it at the moment, it makes the
naming of `"workspace"` more clear and leaves the object open for more
config in the future.

Closes #24456
  • Loading branch information
dsherret authored Jul 9, 2024
1 parent 3674f45 commit e5c3c21
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ console_static_text = "=0.8.1"
data-encoding = "2.3.3"
data-url = "=0.3.0"
deno_cache_dir = "=0.10.0"
deno_config = { version = "=0.20.2", default-features = false }
deno_config = { version = "=0.20.4", default-features = false }
dlopen2 = "0.6.1"
ecb = "=0.1.2"
elliptic-curve = { version = "0.13.4", features = ["alloc", "arithmetic", "ecdh", "std", "pem"] }
Expand Down
3 changes: 2 additions & 1 deletion cli/lsp/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1534,11 +1534,12 @@ impl ConfigData {

let workspace = config_file
.as_ref()
.and_then(|c| c.json.workspace.as_ref().map(|w| (c, w)));
.and_then(|c| c.to_workspace_config().ok().flatten().map(|w| (c, w)));
let is_workspace_root = workspace.is_some();
let workspace_members = if let Some((config, workspace)) = workspace {
Arc::new(
workspace
.members
.iter()
.flat_map(|p| {
let dir_specifier = config.specifier.join(p).ok()?;
Expand Down
26 changes: 21 additions & 5 deletions cli/schemas/config-file.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,27 @@
]
},
"workspace": {
"type": "array",
"items": {
"type": "string"
},
"description": "The members of this workspace."
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
},
"description": "The members of this workspace."
},
{
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "string"
},
"description": "The members of this workspace."
}
}
}
]
}
}
}

0 comments on commit e5c3c21

Please sign in to comment.