Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcards in fortls #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions fortls/langserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -256,7 +258,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
Expand Down Expand Up @@ -673,7 +675,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(
Expand Down Expand Up @@ -1291,7 +1293,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:
Expand Down