From 5d073560e51ca93e2bc06428daf8f56bccbb102c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=D9=90l-Mi=27raj?= <54112754+AnonMiraj@users.noreply.github.com> Date: Sun, 17 Mar 2024 06:19:20 +0000 Subject: [PATCH] fix #348 more debug details --- fortls/langserver.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/fortls/langserver.py b/fortls/langserver.py index 422061d9..6dfa2da4 100644 --- a/fortls/langserver.py +++ b/fortls/langserver.py @@ -197,9 +197,9 @@ def serve_initialize(self, request: dict): ) self.source_dirs.add(self.root_path) - self._load_config_file() + config_dict = self._load_config_file() self._resolve_globs_in_paths() - self._config_logger(request) + self._config_logger(request, config_dict) self._load_intrinsics() self._add_source_dirs() if self._update_version_pypi(): @@ -1527,6 +1527,8 @@ def serve_default(self, request: dict): def _load_config_file(self) -> None: """Loads the configuration file for the Language Server""" + config_dict = None + # Check for config files default_conf_files = [self.config, ".fortlsrc", ".fortls.json", ".fortls"] present_conf_files = [ @@ -1570,6 +1572,9 @@ def _load_config_file(self) -> None: msg = f'Error: "{e}" while reading "{self.config}" Configuration file' self.post_message(msg) + return config_dict + + def _load_config_file_dirs(self, config_dict: dict) -> None: self.excl_paths = set(config_dict.get("excl_paths", self.excl_paths)) self.source_dirs = set(config_dict.get("source_dirs", self.source_dirs)) @@ -1732,6 +1737,13 @@ def _config_logger(self, request) -> None: consoleHandler = logging.StreamHandler() log.addHandler(consoleHandler) log.debug("REQUEST %s %s", request.get("id"), request.get("method")) + for arg in sys.argv[1:]: + log.debug("Cli Options: %s", arg) + if config_dict is not None: + for key, value in config_dict.items(): + log.debug("Config Options: %s,%s", key, value) + else: + log.debug("No config file were passed") self.post_messages.append([Severity.info, "fortls debugging enabled"]) else: logging.basicConfig(format=fmt, datefmt="%H:%M:%S", level=logging.INFO)