Skip to content

Commit 785fed6

Browse files
mmahroussfda-odoo
authored andcommitted
[FIX] fix xml parsing error diagnostics
1 parent ce49fed commit 785fed6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

server/src/core/diagnostic_codes_list.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ OLS03301, DiagnosticSetting::Warning, "Deprecation Warning: Since 17.0: odoo.tes
230230
*/
231231
OLS03302, DiagnosticSetting::Warning, "The active key is deprecated",
232232
/**
233+
* Parsing error in XML file
234+
*/
235+
OLS05000, DiagnosticSetting::Error, "Unable to parse XML file: {0}",
236+
/**
233237
* The XML ID you referenced has not been found in any XML in this module or its dependencies
234238
*/
235239
OLS05001, DiagnosticSetting::Error, "Unknown XML ID",
@@ -258,7 +262,7 @@ OLS05006, DiagnosticSetting::Error, "menuitem node must contains an id attribute
258262
OLS05007, DiagnosticSetting::Error, "Invalid attribute {0} in menuitem node",
259263
/**
260264
*/
261-
OLS05008, DiagnosticSetting::Error, "Sequence attribute must be a string representing a number",
265+
OLS05008, DiagnosticSetting::Error, "Sequence attribute must be a string representing an integer",
262266
/**
263267
*/
264268
OLS05009, DiagnosticSetting::Error, "SubmenuItem is not allowed when action and parent attributes are defined on a menuitem",

server/src/core/symbols/xml_file_symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl XmlFileSymbol {
145145

146146
pub fn build_syntax_diagnostics(session: &SessionInfo, diagnostics: &mut Vec<Diagnostic>, file_info: &mut FileInfo, doc_error: &Error) {
147147
let offset = file_info.position_to_offset(doc_error.pos().row -1, doc_error.pos().col -1, session.sync_odoo.encoding);
148-
if let Some(diagnostic) = crate::core::diagnostics::create_diagnostic(session, DiagnosticCode::OLS04010, &[&doc_error.to_string()]) {
148+
if let Some(diagnostic) = crate::core::diagnostics::create_diagnostic(session, DiagnosticCode::OLS05000, &[&doc_error.to_string()]) {
149149
diagnostics.push(lsp_types::Diagnostic {
150150
range: lsp_types::Range::new(lsp_types::Position::new(offset as u32, 0), lsp_types::Position::new(offset as u32 + 1, 0)),
151151
..diagnostic.clone()

0 commit comments

Comments
 (0)