Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

PLS doesn't handle changes to python.autoComplete.extraPaths setting #507

Closed

Description

@erictraut

If I define one or more entries in the python.autoComplete.extraPaths setting, the PLS correctly uses the defined path(s) as part of its import resolution. However, if I modify the setting, the PLS doesn't correctly pick up the change. Closing and opening the IDE solves the problem.

I'm not sure if this is a problem with the vscode python extension or the PLS.

Activity

  1. AlexanderSher commented on Dec 31, 2018

    @AlexanderSher
    Contributor

    LS receives extraPaths as part of PythonInitializationOptions.searchPaths when it is started. Mikhail Arkhipov (@MikhailArkhipov) , do you know if LS is restarted when this parameter is changed?

  2. MikhailArkhipov commented on Jan 2, 2019

    @MikhailArkhipov

    It didn't change AFAIK.
    https://github.com/Microsoft/vscode-python/blob/master/src/client/activation/languageServer/languageServer.ts#L246-253

            let searchPaths = interpreterData ? interpreterData.searchPaths.split(path.delimiter) : [];
            const settings = this.configuration.getSettings();
            if (settings.autoComplete) {
                const extraPaths = settings.autoComplete.extraPaths;
                if (extraPaths && extraPaths.length > 0) {
                    searchPaths.push(...extraPaths);
                }
            }

    However, change of configuration does not restart the LS and current implementation is not capable of handling the search path update without the restart. Restarting IDE is not necessary, there is 'Reload Window' command in VS Code.

  3. DonJayamanne commented on Jan 3, 2019

    @DonJayamanne

    Is it not possible for the LS to react to changes to this setting if it was somehow propagated to LS.
    Ie can LS react to changes without having to restart the LS.

  4. MikhailArkhipov commented on Jun 20, 2019

    @MikhailArkhipov

    May be part of #1213

  5. jakebailey commented on Jul 10, 2019

    @jakebailey
    Member

    With #1289 merged, this could now be possible. Paths are now resolved later at the first ReloadAsync, versus in the initialization. Since the extension has been starting the language server with PYTHONPATH set, we could stop accepting searchPaths in our initialization options, then do the combining of PYTHONPATH/extraPaths together ourselves. Doing this would allow us to redo that work when we see the config change.

    But we'd need to decide whether or not python.autoComplete.extraPaths is the actual configuration name we want to give this. I expect we want settings under python.analysis instead, with some more granularity to let people pick and choose which paths go where (instead of a big list).

  6. Jma353 commented on Jul 12, 2019

    @Jma353

    Moving away from searchPaths and towards config-driven extraPaths that reacts to changes in the config would be awesome!

  7. jakebailey commented on Jul 25, 2019

    @jakebailey
    Member

    I'm going to close this in favor of #1388. This should now be doable (as previously said). The setting name is likely to change, as it's a relic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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