Skip to content

Commit 4b34121

Browse files
committed
[IMP] server: update ruff python parser to 0.11.4
1 parent a32423d commit 4b34121

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

server/Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
name = "odoo_ls_server"
33
version = "0.4.1"
44
edition = "2021"
5+
authors = ["Odoo"]
6+
readme = "../README.md"
7+
repository = "https://github.com/odoo/odoo-ls"
8+
license = "../LICENSE"
59

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

@@ -11,9 +15,9 @@ clap = { version = "4.5.4", features = ["derive"] }
1115
glob = "0.3.1"
1216
regex = "1.10.3"
1317
ropey = "1.6.1"
14-
ruff_python_ast = { git = "https://github.com/astral-sh/ruff", tag = "0.6.9", version = "0.0.0" }
15-
ruff_python_parser = { git = "https://github.com/astral-sh/ruff", tag = "0.6.9", version = "0.0.0" }
16-
ruff_text_size = { git = "https://github.com/astral-sh/ruff", tag = "0.6.9", version = "0.0.0" }
18+
ruff_python_ast = { git = "https://github.com/astral-sh/ruff", tag = "0.11.4", version = "0.0.0" }
19+
ruff_python_parser = { git = "https://github.com/astral-sh/ruff", tag = "0.11.4", version = "0.0.0" }
20+
ruff_text_size = { git = "https://github.com/astral-sh/ruff", tag = "0.11.4", version = "0.0.0" }
1721
lsp-server = { git = "https://github.com/rust-lang/rust-analyzer", tag = "2024-06-17", version = "0.7.6" }
1822
serde = "1.0.195"
1923
serde_json = "1.0.111"

server/src/core/file_mgr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use lsp_types::notification::{Notification, PublishDiagnostics};
22
use ropey::Rope;
33
use ruff_python_ast::Mod;
4-
use ruff_python_parser::{Mode, Parsed, Token, TokenKind};
4+
use ruff_python_parser::{Mode, ParseOptions, Parsed, Token, TokenKind};
55
use lsp_types::{Diagnostic, DiagnosticSeverity, MessageType, NumberOrString, Position, PublishDiagnosticsParams, Range, TextDocumentContentChangeEvent};
66
use tracing::{error, warn};
77
use std::collections::hash_map::DefaultHasher;
@@ -126,7 +126,7 @@ impl FileInfo {
126126
let mut diagnostics = vec![];
127127
let content = &self.text_rope.as_ref().unwrap().slice(..);
128128
let source = content.to_string(); //cast to string to get a version with all changes
129-
let ast = ruff_python_parser::parse_unchecked(source.as_str(), Mode::Module);
129+
let ast = ruff_python_parser::parse_unchecked(source.as_str(), ParseOptions::from(Mode::Module));
130130
if in_workspace {
131131
self.noqas_blocs.clear();
132132
self.noqas_lines.clear();

server/src/core/odoo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use byteyarn::{yarn, Yarn};
1515
use lsp_server::ResponseError;
1616
use lsp_types::*;
1717
use request::{RegisterCapability, Request, WorkspaceConfiguration};
18-
use ruff_python_parser::Mode;
18+
use ruff_python_parser::{Mode, ParseOptions};
1919
use tracing::{debug, error, warn, info, trace};
2020

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

0 commit comments

Comments
 (0)