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

Conside include, extend-include for the native server #12252

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Jul 9, 2024

Summary

This PR updates the native server to consider the include and extend-include file resolver settings.

fixes: #12242

Test Plan

Note: Settings reloading doesn't work for nested configs which is fixed in #12253 so the preview here only showcases root level config.

Screen.Recording.2024-07-09.at.12.46.45.mov

Copy link
Contributor

github-actions bot commented Jul 9, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

warning: Detected debug build without --no-cache.
error: Failed to parse examples/chatgpt/gpt_actions_library/.gpt_action_getting_started.ipynb:11:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_bigquery.ipynb:13:1:1: Expected an expression

Formatter (preview)

ℹ️ ecosystem check encountered format errors. (no format changes; 1 project error)

openai/openai-cookbook (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Failed to parse examples/chatgpt/gpt_actions_library/.gpt_action_getting_started.ipynb:11:1:1: Expected an expression
error: Failed to parse examples/chatgpt/gpt_actions_library/gpt_action_bigquery.ipynb:13:1:1: Expected an expression

@dhruvmanila dhruvmanila marked this pull request as ready for review July 9, 2024 07:18
@dhruvmanila dhruvmanila added bug Something isn't working server Related to the LSP server labels Jul 9, 2024
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Do we also need this for fix_all?

// If the document is excluded, return an empty list of fixes.
let package = if let Some(document_path) = document_path.as_ref() {
if let Some(exclusion) = match_any_exclusion(
document_path,
&file_resolver_settings.exclude,
&file_resolver_settings.extend_exclude,
Some(&linter_settings.exclude),
None,
) {
tracing::debug!(
"Ignored path via `{}`: {}",
exclusion,
document_path.display()
);
return Ok(Fixes::default());
}
detect_package_root(
document_path
.parent()
.expect("a path to a document should have a parent path"),
&linter_settings.namespace_packages,
)
} else {
None
};

and format_text_document_range?

// If the document is excluded, return early.
if let Some(file_path) = query.file_path() {
if let Some(exclusion) = match_any_exclusion(
&file_path,
&file_resolver_settings.exclude,
&file_resolver_settings.extend_exclude,
None,
Some(&formatter_settings.exclude),
) {
tracing::debug!("Ignored path via `{}`: {}", exclusion, file_path.display());
return Ok(None);
}
}

Should we have a unified helper to avoid the code repetion?

@dhruvmanila
Copy link
Member Author

Yes, we'll require for both. I think it'd make sense to add a helper for that.

@dhruvmanila dhruvmanila force-pushed the dhruv/server-include branch 2 times, most recently from 8af9e89 to 3b3cf58 Compare July 9, 2024 12:35
@dhruvmanila dhruvmanila enabled auto-merge (squash) July 10, 2024 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server Related to the LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ruff server does not consider config include
2 participants