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

Collection of mod_dirs in language_server.py does not work with relative paths #87

Closed
mscfd opened this issue Feb 27, 2019 · 1 comment
Labels

Comments

@mscfd
Copy link

mscfd commented Feb 27, 2019

Something like
fortls --debug_rootpath src --debug_completion --debug_filepath src/some.f90 --debug_line 123 --debug_char 456

fails as subdirectories are not collected correctly. In fact in line 479 of langserver.py (tag 1.2.1) the os.path.join is wrong. As far as I can see local variable dirName is the relative path (relative to current working directory). If the provided path in --debug_rootpath is absolute, then dirName is also absolute and the os.path.join just returns its second argument (i.e. dirName). So a simple patch is to replace
self.mod_dirs.append(os.path.join(self.root_path, dirName))
by
self.mod_dirs.append(dirName)

But I guess a proper solution might involve something like normalising all involved paths.

@hansec
Copy link
Owner

hansec commented Feb 27, 2019

Thanks for the report. Yep, the fix you suggested should work fine and will be included in the next patch.

@hansec hansec added the bug label Feb 27, 2019
@hansec hansec closed this as completed in d921a38 Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants