@@ -1492,6 +1492,11 @@ def _load_config_file(self) -> None:
1492
1492
1493
1493
# Check for config file
1494
1494
config_path = os .path .join (self .root_path , self .config )
1495
+ # NOTE: it would be better if we could distinguish between a user-defined
1496
+ # and a default config file. If not user-defined then we can check for
1497
+ # default names, currently only .fortls. If None are found return None
1498
+ # if user-defined config we would want to throw an error if the file
1499
+ # cannot be found
1495
1500
if not os .path .isfile (config_path ):
1496
1501
return None
1497
1502
@@ -1521,14 +1526,12 @@ def _load_config_file(self) -> None:
1521
1526
self .debug_log = True
1522
1527
1523
1528
except FileNotFoundError :
1524
- self .post_messages (
1525
- [Severity .error , f"Error settings file '{ self .config } ' not found" ]
1526
- )
1529
+ self .post_message (f"Configuration file '{ self .config } ' not found" )
1527
1530
1528
- except ValueError :
1529
- self . post_messages (
1530
- [ Severity . error , f"Error while parsing '{ self .config } ' settings file" ]
1531
- )
1531
+ # Erroneous json file syntax
1532
+ except ValueError as e :
1533
+ msg = f"Error: ' { e } ' while reading '{ self .config } ' Configuration file"
1534
+ self . post_message ( msg )
1532
1535
1533
1536
def _load_config_file_dirs (self , config_dict : dict ) -> None :
1534
1537
# Exclude paths (directories & files)
@@ -1545,7 +1548,7 @@ def _load_config_file_dirs(self, config_dict: dict) -> None:
1545
1548
self .source_dirs .update (set (dirs ))
1546
1549
except FileNotFoundError as e :
1547
1550
err = f"Directories input in Configuration file do not exit:\n { e } "
1548
- self .post_messages ([ Severity .warn , err ] )
1551
+ self .post_message ( err , Severity .warn )
1549
1552
1550
1553
# Keep all directories present in source_dirs but not excl_paths
1551
1554
self .source_dirs = {i for i in self .source_dirs if i not in self .excl_paths }
@@ -1617,7 +1620,7 @@ def _load_config_file_preproc(self, config_dict: dict) -> None:
1617
1620
self .include_dirs .update (set (dirs ))
1618
1621
except FileNotFoundError as e :
1619
1622
err = f"Directories input in Configuration file do not exit:\n { e } "
1620
- self .post_messages ([ Severity .warn , err ] )
1623
+ self .post_message ( err , Severity .warn )
1621
1624
1622
1625
def _add_source_dirs (self ) -> None :
1623
1626
"""Will recursively add all subdirectories that contain Fortran
0 commit comments