Skip to content

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

Closed
@mscfd

Description

@mscfd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions