Skip to content
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
erictraut opened this issue Dec 25, 2018 · 7 comments
Closed

Comments

@erictraut
Copy link

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.

@AlexanderSher
Copy link
Contributor

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

@MikhailArkhipov
Copy link

MikhailArkhipov commented Jan 2, 2019

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.

@MikhailArkhipov MikhailArkhipov removed the bug Something isn't working label Jan 2, 2019
@DonJayamanne
Copy link

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.

@MikhailArkhipov
Copy link

May be part of #1213

@jakebailey
Copy link
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).

@Jma353
Copy link

Jma353 commented Jul 12, 2019

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

@jakebailey
Copy link
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants