From 36ebbc858ae94325edb6613546f1a55bc611a4e2 Mon Sep 17 00:00:00 2001 From: "Peter M. Clausen" Date: Tue, 30 Mar 2021 20:30:20 +0200 Subject: [PATCH 1/2] Changing 'array.count(v)>0' to 'v in array' --- fortls/langserver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fortls/langserver.py b/fortls/langserver.py index d4799a5..cf42754 100644 --- a/fortls/langserver.py +++ b/fortls/langserver.py @@ -256,7 +256,7 @@ def serve_initialize(self, request): if len(self.source_dirs) == 1: self.source_dirs = [] for dirName, subdirList, fileList in os.walk(self.root_path): - if self.excl_paths.count(dirName) > 0: + if dirName in self.excl_paths: while(len(subdirList) > 0): del subdirList[0] continue @@ -673,7 +673,7 @@ def build_comp(candidate, name_only=self.autocomplete_name_only, name_replace = candidate.name for member in candidate.mems: tmp_text, _ = member.get_snippet(name_replace) - if tmp_list.count(tmp_text) > 0: + if tmp_text in tmp_list: continue tmp_list.append(tmp_text) item_list.append(build_comp( @@ -1291,7 +1291,7 @@ def workspace_init(self): _, ext = os.path.splitext(os.path.basename(filename)) if FORTRAN_EXT_REGEX.match(ext): filepath = os.path.normpath(os.path.join(source_dir, filename)) - if self.excl_paths.count(filepath) > 0: + if filepath in self.excl_paths: continue inc_file = True for excl_suffix in self.excl_suffixes: From a43941285a5ef5624b4ccde88870f52413859564 Mon Sep 17 00:00:00 2001 From: "Peter M. Clausen" Date: Tue, 30 Mar 2021 20:41:01 +0200 Subject: [PATCH 2/2] Adding glob to excl_paths --- fortls/langserver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fortls/langserver.py b/fortls/langserver.py index cf42754..a887cfb 100644 --- a/fortls/langserver.py +++ b/fortls/langserver.py @@ -193,10 +193,12 @@ def serve_initialize(self, request): if config_exists: try: import json + import glob with open(config_path, 'r') as fhandle: config_dict = json.load(fhandle) for excl_path in config_dict.get("excl_paths", []): - self.excl_paths.append(os.path.join(self.root_path, excl_path)) + for glob_excl_path in glob.glob(os.path.join(self.root_path, excl_path)): + self.excl_paths.append( glob_excl_path ) source_dirs = config_dict.get("source_dirs", []) ext_source_dirs = config_dict.get("ext_source_dirs", []) # Legacy definition