Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: remove invocationLocation in favor of invocationStrategy #17888

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

Tyrubias
Copy link
Contributor

These flags were added to help rust-analyzer integrate with repos requiring non-Cargo invocations. The consensus is that having two independent settings are no longer needed. This change removes invocationLocation in favor of invocationStrategy and changes the internal representation of InvocationStrategy::Once to hold the workspace root.

Closes #17848.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 14, 2024
@Tyrubias
Copy link
Contributor Author

I changed both project_model::InvocationStrategy::Once and flycheck::InvocationStrategy::Once to hold the workspace root. I'm not sure if this is actually needed because it appears the workspace root is available from other sources whenever these enum variants are used. Let me know if we actually need it in one or both enums.

@Veykril
Copy link
Member

Veykril commented Aug 15, 2024

I changed both project_model::InvocationStrategy::Once and flycheck::InvocationStrategy::Once to hold the workspace root. I'm not sure if this is actually needed because it appears the workspace root is available from other sources whenever these enum variants are used. Let me know if we actually need it in one or both enums.

Right, looks like we don't need the variants to hold that info at all

@Tyrubias Tyrubias force-pushed the remove-invocation-location branch from e169687 to b5ae2c6 Compare August 17, 2024 23:19
…ategy`

These flags were added to help rust-analyzer integrate with repos
requiring non-Cargo invocations. The consensus is that having two
independent settings are no longer needed. This change removes
`invocationLocation` in favor of `invocationStrategy` and changes
the internal representation of `InvocationStrategy::Once` to hold
the workspace root.
@Tyrubias Tyrubias force-pushed the remove-invocation-location branch from b5ae2c6 to b0f20c7 Compare August 19, 2024 07:25
@Veykril
Copy link
Member

Veykril commented Aug 19, 2024

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Aug 19, 2024

📌 Commit b0f20c7 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 19, 2024

⌛ Testing commit b0f20c7 with merge c187939...

@bors
Copy link
Contributor

bors commented Aug 19, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing c187939 to master...

@bors bors merged commit c187939 into rust-lang:master Aug 19, 2024
11 checks passed
@lnicola lnicola changed the title chore(config): remove invocationLocation in favor of invocationStrategy internal: remove invocationLocation in favor of invocationStrategy Aug 19, 2024
/// - "root": run build scripts in the project's root directory.
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
/// is set.
cargo_buildScripts_invocationLocation: InvocationLocation = InvocationLocation::Workspace,
/// Specifies the invocation strategy to use when running the build scripts command.
/// If `per_workspace` is set, the command will be executed for each workspace.
/// If `once` is set, the command will be executed once.
Copy link
Member

@RalfJung RalfJung Aug 19, 2024

Choose a reason for hiding this comment

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

This should document the working directory that the command will be executed in, for both cases.

@@ -3196,14 +3158,6 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
"The command will be executed once."
Copy link
Member

Choose a reason for hiding this comment

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

Might be good to also mention the effect on the working directory here.

))
}
};
let current_dir = workspace_root;
Copy link
Member

Choose a reason for hiding this comment

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

I am surprised by this; once should not be per-workspace... or does this refer to the vscode concept of a workspace rather than the cargo concent?

The argument list for this function is quite confusing since there are multiple "workspaces" but then just a single "workspace_root"...

Copy link
Member

Choose a reason for hiding this comment

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

The variable name here is a bit misleading (should be renamed into current_dir/working_dir, the sole caller of this passes the actual root here.

bors added a commit that referenced this pull request Aug 19, 2024
minor: Improve documentation for `InvocationStrategy`

cc #17888
@Tyrubias Tyrubias deleted the remove-invocation-location branch August 24, 2024 18:21
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 29, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 1, 2024
…tings, r=jieyouxu

Remove unncessary option for default rust-analyzer setting

In favor of rust-lang/rust-analyzer#17888
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Nov 1, 2024
…tings, r=jieyouxu

Remove unncessary option for default rust-analyzer setting

In favor of rust-lang/rust-analyzer#17888
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Nov 1, 2024
…tings, r=jieyouxu

Remove unncessary option for default rust-analyzer setting

In favor of rust-lang/rust-analyzer#17888
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 2, 2024
Rollup merge of rust-lang#132438 - chenyukang:yukang-fix-analyzer_settings, r=jieyouxu

Remove unncessary option for default rust-analyzer setting

In favor of rust-lang/rust-analyzer#17888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collapse invocationLocation and invocationStrategy into a single setting
5 participants