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
merged 20 commits into from
Mar 14, 2019
Merged

Wire up events from RDT to module resolution #703

merged 20 commits into from
Mar 14, 2019

Conversation

MikhailArkhipov
Copy link

@MikhailArkhipov MikhailArkhipov commented Mar 5, 2019

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 MikhailArkhipov changed the title [WIP]: Wire up events from RDT to module resolution Wire up events from RDT to module resolution Mar 6, 2019
_disposableBag.ThrowIfDisposed();
// TODO: handle?
switch (c.type) {
case FileChangeType.Deleted:
Copy link
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
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
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.

@@ -65,12 +66,14 @@ private class DocumentEntry {
lock (_lock) {
entry = FindDocument(null, uri);
if (entry == null) {
var resolver = _services.GetService<IPythonInterpreter>()?.ModuleResolution?.CurrentPathResolver;
Copy link
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?

@MikhailArkhipov MikhailArkhipov merged commit 1192f5d into microsoft:master Mar 14, 2019
@MikhailArkhipov MikhailArkhipov deleted the rdt branch March 14, 2019 16:23
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