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

Wire up events from RDT to module resolution - #703

Merged
Mikhail Arkhipov (MikhailArkhipov) merged 20 commits into
microsoft:masterfrom
MikhailArkhipov:rdt
Mar 14, 2019
Merged

Mikhail Arkhipov (MikhailArkhipov) merged 20 commits into
microsoft:masterfrom
MikhailArkhipov:rdt

Conversation

@MikhailArkhipov

@MikhailArkhipov Mikhail Arkhipov (MikhailArkhipov) commented Mar 5, 2019 •

Copy link
Copy Markdown

Fixes #700

  • Make sure RDT maintains proper lock count for imported/opened modules.
  • Update diagnostics reporting when module is closed or removed.
  • Fix search paths that were duplicated in user and interpreter paths.
  • Fix determination if module is user or library.
  • Tests.

@MikhailArkhipov Mikhail Arkhipov (MikhailArkhipov) changed the title [WIP]: Wire up events from RDT to module resolution Wire up events from RDT to module resolution Mar 6, 2019
Comment thread src/Analysis/Core/Impl/DependencyResolution/PathResolverSnapshot.cs Outdated
Comment thread src/LanguageServer/Test/RdtTests.cs Outdated
_disposableBag.ThrowIfDisposed();
// TODO: handle?
switch (c.type) {
case FileChangeType.Deleted:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you know if this case gets hit?

image

b and food still seem to exist after I make b with def foo(): return 123, import it in a, then delete b, but I could be testing something different than what this handles.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Frankly, I haven't seen it hit. I don't know when VSC sends it, this is why we have manual library watcher. But it doesn't hurt to handle.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We could start watching workspace manually too, but that's a different issue.

lock (_lock) {
entry = FindDocument(null, uri);
if (entry == null) {
var resolver = _services.GetService<IPythonInterpreter>()?.ModuleResolution?.CurrentPathResolver;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the case when _services.GetService<IPythonInterpreter>() or ModuleResolution is null?

Comment thread src/Analysis/Ast/Impl/Documents/RunningDocumentTable.cs Outdated
Comment thread src/Analysis/Ast/Impl/Modules/PythonModule.cs Outdated
Comment thread src/LanguageServer/Test/RdtTests.cs
Comment thread src/LanguageServer/Test/RdtTests.cs
@MikhailArkhipov
Mikhail Arkhipov (MikhailArkhipov) merged commit 1192f5d into microsoft:master Mar 14, 2019
Jake Bailey (jakebailey) pushed a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
* Fix microsoft#668 (partial)

* Tests

* Revert "Tests"

This reverts commit 7ffc9db.

* Basic event wire up

* Add test

* Test

* Formatting

* Fix search paths mess

* Handle deleted files better

* PR feedback

* MErge issues

* Fix race condition at builtins load

* PR feedback
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing and reopening documents may stop editor functionality

3 participants