pyright-langserver-for-pycharm icon indicating copy to clipboard operation
pyright-langserver-for-pycharm copied to clipboard

Resolve interpreter correctly for non-PyCharm IDEs

Open InSyncWithFoo opened this issue 1 year ago • 6 comments

Presumably fixes #41. Not tested.

InSyncWithFoo avatar May 12 '24 09:05 InSyncWithFoo

Qodana Community for JVM

1 new problem were found

Inspection name Severity Problems
Unused symbol 🔶 Warning 1

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true, so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

  • Or via our issue tracker: https://jb.gg/qodana-issue
  • Or share your feedback: https://jb.gg/qodana-discussions

github-actions[bot] avatar May 12 '24 09:05 github-actions[bot]

I've tested the following IDEs on Windows (latest stable versions unless otherwise indicated):

  • CLion - works
  • IntelliJ Ultimate - works
  • RustRover 2024.1 EAP - works
  • Rider - works

The results all look like this:

>>> from collections.abc import Callable
>>>
>>> v: Callable[[int], bool] = 1
                               ^
Pyright: Expression of type "Literal[1]" is incompatible with declared type "(int) -> bool"
   Type "Literal[1]" is incompatible with type "(int) -> bool" (reportAssignmentType)

bzoracler avatar May 13 '24 20:05 bzoracler

@bzoracler Thanks a lot! That saved me an unimaginably vast amount of work.

Could you show me the corresponding log entries? If that's something you don't want to show publicly, you could redact private parts and/or send me an email at <this account's name>@gmail.com.

InSyncWithFoo avatar May 13 '24 21:05 InSyncWithFoo

After hours of debugging I conclude that a null interpreter is not the cause of what I saw in #41.

Painfully, that means I have two problems, one here and one has yet to be discovered.

InSyncWithFoo avatar May 14 '24 04:05 InSyncWithFoo

I've sent over a log file from a CLion session - hopefully that helps.

bzoracler avatar May 14 '24 18:05 bzoracler

@bzoracler Thanks, but the file doesn't contain any LSP log entries, which would look something like this:

#c.i.p.l.i.c.Lsp4jServerConnector - --> PyrightLSDescriptor@project: {"jsonrpc":"2.0", ...}
#c.i.p.l.i.c.Lsp4jServerConnector - <-- PyrightLSDescriptor@project: {"jsonrpc":"2.0", ...}

Perhaps you forgot to enable logging?

Specifically, what I want to look at the most is the didChangeConfiguration request as sent by Listener on server initialization. If the interpreter is not passed correctly, the JSON data will have no params.settings.python.pythonPath property, as shown here.

InSyncWithFoo avatar May 14 '24 20:05 InSyncWithFoo

The logic was copied from PyInterpreterInspection. It sure feels good randomly stumping into something that would help solve a 2-month-old issue.

InSyncWithFoo avatar Jun 25 '24 04:06 InSyncWithFoo

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true, so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

  • Or via our issue tracker: https://jb.gg/qodana-issue
  • Or share your feedback: https://jb.gg/qodana-discussions

github-actions[bot] avatar Jun 25 '24 04:06 github-actions[bot]