Skip to content

feat: fortls discovery on Windows #957

Open
@michaelkonecny

Description

@michaelkonecny

Is there an existing request for this?

  • I have searched the existing issues

Feature Request

On Windows, pip install --user fortls installs fortls into %appdata%\Python\PythonXY\Scripts, which is typically not in PATH.

I'd like the extension to be able to discover fotrls in this location as well, as one could then just install the extension, accept the suggestion to install fortls and start working. This is currently not the case.

At the same time, I don't want to break anything for existing users.

I would suggest using this logic:
If the the configuration value of fortls.path is equal to the default value, then:

  • try if fortls is callable globally
  • if not and we're on Windows, try to look into the %appdata% python scripts folder mentioned above

If the value of fortls.path is not default, then follow the logic we have currently (if path is absolute, use it. if it is relative, try to resolve it relative to the document/workspace/home folder).

One think I am hesitant about is whether the default value of fortls.path should remain fortls. It makes complete sense for the current logic and linux/mac, as the value mimic the way you would run fortls from bash.
But if the server is run from the %appdata% scripts folder, it seems nicer to me to have the default value be an empty string and maybe add a little explanation somewhere on where fortls is run from on each of the platforms.

@gnikit what do you think?

I will prepare a PR, but I don't want to rush things until we agree...

Note to self: issue #773 (lookup of formatters) is related and should be dealt with after this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions