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

Upgrade Ruff to v0.0.92 #17

Merged
merged 1 commit into from
Oct 31, 2022
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
12 changes: 6 additions & 6 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions ruffd-core/src/server_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ fn message_into_diagnostic(msg: Message) -> lsp_types::Diagnostic {
// As ruff currently doesn't support the span of the error,
// only have it span a single character
let range = {
// diagnostic is zero indexed, but message is 1-indexed
let row_start = msg.location.row() as u32 - 1;
// diagnostic is zero indexed, but message rows are 1-indexed
let row_start = msg.location.row() as u32;
let col_start = msg.location.column() as u32 - 1;
let row_end = msg.end_location.row() as u32 - 1;
let row_end = msg.end_location.row() as u32;
let col_end = msg.end_location.column() as u32 - 1;
let start = lsp_types::Position {
line: row_start,
Expand Down Expand Up @@ -61,7 +61,7 @@ pub fn run_diagnostic_op(document_uri: lsp_types::Url) -> ServerNotification {
if let Some(buffer) = open_buffers.get(&document_uri) {
let doc = buffer.iter().collect::<String>();
if let Ok(path) = document_uri.to_file_path() {
check(&path, &doc, true).unwrap_or_default()
check(&path, &doc).unwrap_or_default()
} else {
vec![]
}
Expand Down
2 changes: 1 addition & 1 deletion ruffd-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
lsp-types = "0.93"
ruff = { git = "https://github.com/charliermarsh/ruff", tag = "v0.0.85", version = "0.0.85" }
ruff = { git = "https://github.com/charliermarsh/ruff", tag = "v0.0.92", version = "0.0.92" }
tokio = { version = "1.20", features = ["full"] }
serde = "1.0"
serde_json = "1.0"
Expand Down
11 changes: 5 additions & 6 deletions ruffd-types/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::collections::{AggAvlTree, Rope};
use crate::error::{DocumentError, RuntimeError};
use ruff::settings::RawSettings;
use ruff::settings::configuration::Configuration;
use std::collections::HashMap;
use std::ops::RangeBounds;
use std::sync::Arc;
Expand Down Expand Up @@ -162,7 +162,7 @@ pub struct ServerState {
pub project_root: Arc<RwLock<Option<lsp_types::Url>>>,
pub open_buffers: Arc<RwLock<HashMap<lsp_types::Url, DocumentBuffer>>>,
pub capabilities: Arc<RwLock<lsp_types::ServerCapabilities>>,
pub settings: Arc<RwLock<RawSettings>>,
pub settings: Arc<RwLock<Configuration>>,
}

impl ServerState {
Expand Down Expand Up @@ -195,10 +195,9 @@ impl ServerState {
let project_root = Arc::new(RwLock::new(project_root_val));
let capabilities = Arc::new(RwLock::new(capabilities_val));
let open_buffers = Arc::new(RwLock::new(HashMap::new()));
let settings = Arc::new(RwLock::new(RawSettings::from_pyproject(
let settings = Arc::new(RwLock::new(Configuration::from_pyproject(
&None,
&project_root_path,
true,
)?));
Ok(Self {
settings,
Expand Down Expand Up @@ -239,14 +238,14 @@ pub struct ServerStateLocks {
pub project_root: RwReqOpt<Option<lsp_types::Url>>,
pub open_buffers: RwReqOpt<HashMap<lsp_types::Url, DocumentBuffer>>,
pub capabilities: RwReqOpt<lsp_types::ServerCapabilities>,
pub settings: RwReqOpt<RawSettings>,
pub settings: RwReqOpt<Configuration>,
}

pub struct ServerStateHandles<'a> {
pub project_root: OptRwGuarded<'a, Option<lsp_types::Url>>,
pub open_buffers: OptRwGuarded<'a, HashMap<lsp_types::Url, DocumentBuffer>>,
pub capabilities: OptRwGuarded<'a, lsp_types::ServerCapabilities>,
pub settings: OptRwGuarded<'a, RawSettings>,
pub settings: OptRwGuarded<'a, Configuration>,
}

pub async fn server_state_handles_from_locks(locks: &ServerStateLocks) -> ServerStateHandles<'_> {
Expand Down