This repository was archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
Handle on-the-fly search path configuration changes, read search paths from config directly #1492
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I can see a way to handle the issues with the configuration coming in too late: The server can make a That might be too invasive to do in this change, but, if it's done, the server can just ask the editor for the config, pre-populate the settings (before it ever gets |
…PC call to get the user search paths instead of reloading, bring back searchPaths for full backwards compat
…workspace/configuration
src/Analysis/Ast/Impl/Modules/Resolution/MainModuleResolution.cs
Outdated
Show resolved
Hide resolved
MikhailArkhipov
approved these changes
Aug 30, 2019
This was referenced Sep 16, 2019
jakebailey
added a commit
to jakebailey/python-language-server
that referenced
this pull request
Nov 1, 2019
…s from config directly (microsoft#1492) * Remove SearchPaths and TypeshedPath from Interpreter, move search path logic into module resolution * Move path processing into config change, with unfortunate extra reload * Cleanup usings * Eliminate nulls, since they aren't useful * Move initialization logic from initialize to initialized, and do an RPC call to get the user search paths instead of reloading, bring back searchPaths for full backwards compat * Cleanups * Null checks * Prevent errors on null settings or when the client doesn't implement workspace/configuration * Formatting * Replace IReadOnlyList with ImmutableArray where possible * Eliminate IReadOnlyList * Remove unused default/optional parameter
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1388.
Fixes #915. (Null check added.)
Updates #469. (Less needed from
initializationOptions
,PYTHONPATH
potential.)User configured search paths are now pulled from the user configuration (and on the fly), rather than solely through the initialization options.
To do this, the LS initialization logic has been moved from
initialize
RPC call into theinitialized
notification handler. There, we can ask the editor for the python configuration, and then use the real configuration to set the initial search paths. If the configuration is changed later, then it will be re-processed, and a reload will be triggered if it changes (just like path watching).The old
python.autoComplete.extraPaths
will still work.python.analysis.searchPaths
andpython.analysis.usePYTHONPATH
have been added as a newer interface. Also in this change is a fix which makeswatchSearchPaths
accessible again, aspython.analysis.watchSearchPaths
; previously it was not accessible.Config items:
searchPaths
in the initialization options - Old, last resort.python.autoComplete.extraPaths
- Old, but still read.python.analysis.searchPaths
- New, replacement forextraPaths
. If present, extraPaths is ignored entirely.python.analysis.usePYTHONPATH
- New, true (default) ifPYTHONPATH
should be added to the end ofsearchPaths
/extraPaths
(which the extension did)python.analysis.watchSearchPaths
- Fixed, true (default) if library search paths should be watched for file changes.