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.

Fix path watcher to watch only library paths #1216

Closed

Description

A few months ago, I made some changes to clean up the search path logic in the initialization for the LS and in the extension. This had the effect of the extension no longer calling out to python to get the interpreter paths (duplicate work), but the code for the paths watcher relied on that info being there:

_pathsWatcher?.Dispose();
_pathsWatcher = new PathsWatcher(
    _initParams.initializationOptions.searchPaths,  // <--
    () =>_server.NotifyPackagesChanged(cancellationToken),
        _services.GetService<ILogger>()
    );

_watchSearchPaths = true;
_searchPaths = _initParams.initializationOptions.searchPaths;

So, all the paths watcher does at the moment is watch the user-provided search paths, which can be a bad idea now that extraPaths is the recommended way to configure directories in an editable-installed package.

This code should instead be watching the interpreter paths only. However, that is only available later, since that logic is completed in ReloadModules (which this code also calls).

Likely needs #1213 to be completed first, but this is a motivating example to move the logic for search path analysis earlier (and just have an event which can be used to re-run it and reload everything).

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions