From c72e8c822887310a6d6a8127181859ee16864780 Mon Sep 17 00:00:00 2001 From: M Mahrous Date: Fri, 11 Jul 2025 17:25:16 +0200 Subject: [PATCH] [IMP] server: add wiki link to html repr --- server/src/constants.rs | 3 ++- server/src/core/config.rs | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/server/src/constants.rs b/server/src/constants.rs index 9befeee6..5cc35d29 100644 --- a/server/src/constants.rs +++ b/server/src/constants.rs @@ -120,4 +120,5 @@ pub const BUILT_IN_LIBS: &[&str] = &["string", "re", "difflib", "textwrap", "un "cgi", "cgitb", "chunk", "crypt", "imghdr", "imp", "mailcap", "msilib", "nis", "nntplib", "optparse", "ossaudiodev", "pipes", "smtpd", "sndhdr", "spwd", "sunau", "telnetlib", "uu", "xdrlib", "struct", "codecs"]; -pub const DEFAULT_PYTHON: &str = "python3"; \ No newline at end of file +pub const DEFAULT_PYTHON: &str = "python3"; +pub const CONFIG_WIKI_URL: &str = "https://github.com/odoo/odoo-ls/wiki/Configuration-files"; diff --git a/server/src/core/config.rs b/server/src/core/config.rs index beaac02a..7bf93268 100644 --- a/server/src/core/config.rs +++ b/server/src/core/config.rs @@ -10,7 +10,7 @@ use ruff_python_ast::{Expr, Mod}; use ruff_python_parser::{Mode, ParseOptions}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use crate::constants::DEFAULT_PYTHON; +use crate::constants::{DEFAULT_PYTHON, CONFIG_WIKI_URL}; use crate::core::diagnostics::{DiagnosticCode, DiagnosticSetting}; use crate::utils::{fill_validate_path, has_template, is_addon_path, is_odoo_path, is_python_path, PathSanitizer}; use crate::S; @@ -215,10 +215,20 @@ impl ConfigFile { color: #888; font-size: 0.9em; } + .config-wiki-link { + margin-bottom: 10px; + display: block; + font-family: sans-serif; + font-size: 1em; + color: #2d5fa4; + text-decoration: none; + font-weight: bold; + } -
-"#, - ); +Configuration file documentation →\n"); + html.push_str("
\n"); let entry_htmls: Vec = self.config.iter().map(|entry| { let entry_val = serde_json::to_value(entry).unwrap_or(serde_json::Value::Null); let mut entry_html = String::new();