OctoLinker / OctoLinker

OctoLinker — Links together, what belongs together

Home Page:https://octolinker.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python imports broken in all sort of ways.

laundmo opened this issue · comments

commented

This is a bug report addressing a whole host of issues with the Python import support.

Here's a list of the issues:

  • Every second one of multiple simple imports will fail.
  • Imports using subpackages will not be recognized
  • Imports importing from a package with the package name as the first thing being imported will highlight/link at the wrong location.
  • Relative imports rarely work, related to: #357, especially multi-layer relative imports. (This is technically a feature requestm i know)

To Reproduce
Steps to reproduce most of the described behaviour:

  1. Go to https://gist.github.com/laundmo/55e4799cb446ae5c3535eca6d6a26102
  2. Observe the behaviours outlined in the comments.

I would be willing to write test cases if that helps, but I'm afraid I can't PR an actual fix since I only know a bare minimum of JS. (lots of Python though)

Thanks for filling this issue. I'm aware that our Python coverage is basic and I'm more than happy to improve it. The issue with multiple identical imports is a general limitation of our current implementation, but not obvious in other languages. I'm not sure how easy a fix this would be. I'll look into this, but would prefer to prioritise the other issues you mentioned.

Submitting a few E2E test for the other issues is highly appreciated and the best way for me to tackle this. Adding a E2E tests is quite easy and documented here. Please let me know if you have any questions.

commented

@stefanbuck how would i specify using "OctoLinkerResolve" that the line should resolve to multiple things in multiple locations? How do i specify which word should be linked?

commented

made a PR with test cases #1147