fortran-language-server
fortran-language-server copied to clipboard
Wildcards in fortls
First of all, I am so grateful for this project making my life in Fortran and VSCode so much better.
I was missing the feature of wildcards in .fortls
file, mainly excl_paths
eg
{
"excl_paths": ["sub*"]
}
The change to allow this is line 200. I allowed myself also to change the
`if self.excl_paths.count(dirName) > 0:`
to
if dirName in self.excl_paths:
which I think reads better, but maybe the other implementation has a performance reason or something else I am not aware of.
I was not able to run all test successfully with my Python3.9 on Windows 10. I am getting these assertion errors which I do not how to cope with.
Lib\site-packages\pyflakes\test\test_api.py:816: AssertionError
================================================================ short test summary info ================================================================
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_errors_io - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Python3...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Pyt...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Py...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_goodFile - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Python39...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Pyt...
======================================================= 5 failed, 718 passed, 38 skipped in 8.90s =======================================================
This is a pretty handy feature to have, thanks. IMO I think it is worth adding it in the include paths and include dirs as well, but ultimately that is @hansec 's call.
I should note though that there is a conversation to be had and a choice to be made here. glob.glob()
performs non-recursive pattern matching which might or might not be what the user wants depending on the underlying project. There might be cases where the recursive=True
is what is needed.
For example if you want to exclude all dir1
directories in the following directory structure
. ├── dir1 └── dir2 └── dir1 └── dir2
you would normally do something like
In [2]: glob.glob('**/dir1*', recursive=True)
Out[3]: ['dir1', 'dir2/dir1']
with the current implementation this will only exclude dir2/dir1
.
Good point. I'm fine with any version of wildcard.