Skip to content

[IMP] server: update ruff python parser to 0.11.4 #275

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

Merged
merged 1 commit into from
Apr 9, 2025
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
10 changes: 7 additions & 3 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
name = "odoo_ls_server"
version = "0.4.1"
edition = "2021"
authors = ["Odoo"]
readme = "../README.md"
repository = "https://github.com/odoo/odoo-ls"
license = "../LICENSE"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -11,9 +15,9 @@ clap = { version = "4.5.4", features = ["derive"] }
glob = "0.3.1"
regex = "1.10.3"
ropey = "1.6.1"
ruff_python_ast = { git = "https://github.com/astral-sh/ruff", tag = "0.6.9", version = "0.0.0" }
ruff_python_parser = { git = "https://github.com/astral-sh/ruff", tag = "0.6.9", version = "0.0.0" }
ruff_text_size = { git = "https://github.com/astral-sh/ruff", tag = "0.6.9", version = "0.0.0" }
ruff_python_ast = { git = "https://github.com/astral-sh/ruff", tag = "0.11.4", version = "0.0.0" }
ruff_python_parser = { git = "https://github.com/astral-sh/ruff", tag = "0.11.4", version = "0.0.0" }
ruff_text_size = { git = "https://github.com/astral-sh/ruff", tag = "0.11.4", version = "0.0.0" }
lsp-server = { git = "https://github.com/rust-lang/rust-analyzer", tag = "2024-06-17", version = "0.7.6" }
serde = "1.0.195"
serde_json = "1.0.111"
Expand Down
4 changes: 2 additions & 2 deletions server/src/core/file_mgr.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use lsp_types::notification::{Notification, PublishDiagnostics};
use ropey::Rope;
use ruff_python_ast::Mod;
use ruff_python_parser::{Mode, Parsed, Token, TokenKind};
use ruff_python_parser::{Mode, ParseOptions, Parsed, Token, TokenKind};
use lsp_types::{Diagnostic, DiagnosticSeverity, MessageType, NumberOrString, Position, PublishDiagnosticsParams, Range, TextDocumentContentChangeEvent};
use tracing::{error, warn};
use std::collections::hash_map::DefaultHasher;
Expand Down Expand Up @@ -126,7 +126,7 @@ impl FileInfo {
let mut diagnostics = vec![];
let content = &self.text_rope.as_ref().unwrap().slice(..);
let source = content.to_string(); //cast to string to get a version with all changes
let ast = ruff_python_parser::parse_unchecked(source.as_str(), Mode::Module);
let ast = ruff_python_parser::parse_unchecked(source.as_str(), ParseOptions::from(Mode::Module));
if in_workspace {
self.noqas_blocs.clear();
self.noqas_lines.clear();
Expand Down
4 changes: 2 additions & 2 deletions server/src/core/odoo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use byteyarn::{yarn, Yarn};
use lsp_server::ResponseError;
use lsp_types::*;
use request::{RegisterCapability, Request, WorkspaceConfiguration};
use ruff_python_parser::Mode;
use ruff_python_parser::{Mode, ParseOptions};
use tracing::{debug, error, warn, info, trace};

use std::collections::HashSet;
Expand Down Expand Up @@ -1405,7 +1405,7 @@ impl Odoo {
};
let content = text_rope.slice(..);
let source = content.to_string(); //cast to string to get a version with all changes
let ast = ruff_python_parser::parse_unchecked(source.as_str(), Mode::Module);
let ast = ruff_python_parser::parse_unchecked(source.as_str(), ParseOptions::from(Mode::Module));
if ast.errors().is_empty() {
Odoo::update_file_index(session, path,true, false, false);
}
Expand Down