Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylance will request PTVS to listen for "**/*" under root but we dont… #8059

Closed

Conversation

bschnurr
Copy link
Member

@bschnurr bschnurr commented Nov 7, 2024

… want to listen for file events in the interpreter folder. We already have conda and pip managers listening to them.

This fixes the issue of deleting an "env" folder then having PTVS quickly switching to the default env folder and tells Pylance to update its interpreter settings but the previous env folder file events are still being triggered and after Pylance updates its config it will keep refreshing analysis due to previous env file events.

fixes #8058

… want to listen for file events in the interpreter folder. We already have conda and pip managers listening to them.

This fixes the issue of deleting an "env" folder then having PTVS quickly switching to the default env folder and tells Pylance to update its interpreter settings but the previous env folder file evnets are still being triggered and after Pylance updates its config it will keep refreshing analysis due to previous env file events.
@bschnurr bschnurr requested a review from a team as a code owner November 7, 2024 22:54
@@ -99,7 +99,7 @@ internal sealed class PythonLanguageClient : ILanguageClient, ILanguageClientCus
private static TaskCompletionSource<int> _readyTcs = new TaskCompletionSource<int>();
private bool _loaded = false;
private Timer _deferredSettingsChangedTimer;
private const int _defaultSettingsDelayMS = 2000;
private const int _defaultSettingsDelayMS = 5000;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

increasing settings delay helps delay analysis on while installing new packages

Copy link

sonarcloud bot commented Nov 7, 2024

if (PathUtils.IsSubpathOf(context.RootPath, context.InterpreterConfiguration.InterpreterPath)) {
var pattern = CommonUtils.GetRelativeFilePath(context.RootPath, context.InterpreterConfiguration.GetPrefixPath()) + "/**/*";
var watcher = new FileSystemWatcher() { GlobPattern = pattern };
this._fileListener.AddExclude(watcher);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the fix. just exclude files under the interpreter if the interpreter is under the root workspace

@bschnurr bschnurr closed this Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Long analysis due when creating or deleting the environments folder
1 participant