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

LSP pyright false positive #4476

Open
3 tasks done
vikigenius opened this issue Jun 11, 2024 · 0 comments
Open
3 tasks done

LSP pyright false positive #4476

vikigenius opened this issue Jun 11, 2024 · 0 comments
Labels

Comments

@vikigenius
Copy link

vikigenius commented Jun 11, 2024

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

False positive in lsp pyright doesn't match command line behavior

Steps to reproduce

from typing import Literal


class LWPRSService(object):
    """Lightweight PRS Service."""

    def __init__(self, env: Literal["prod", "dev", "stg"] = "stg", country: Literal["us", "ca"] = "us") -> None:
        super().__init__()

Shows

[Trace - 05:41:47 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/void/Projects/Research/lexutilair/src/lexutilair/prs.py",
  "version": 0,
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 23
        },
        "end": {
          "line": 8,
          "character": 26
        }
      },
      "message": "\"env\" is not accessed",
      "severity": 4,
      "source": "Pyright",
      "tags": [
        1
      ]
    },
    {
      "range": {
        "start": {
          "line": 8,
          "character": 67
        },
        "end": {
          "line": 8,
          "character": 74
        }
      },
      "message": "\"country\" is not accessed",
      "severity": 4,
      "source": "Pyright",
      "tags": [
        1
      ]
    }
  ]
}

Expected behavior

When I run the file through the pyright CLI no diagnostics are produced.

Setting reportUnusedVarialbe = false in pyproject.toml has no effect. And it should not be needed in the first place.

Which Language Server did you use?

lsp-pyright

OS

Linux

Error callstack

No response

Anything else?

I do see a bunch of messages Invalid face reference: lsp-flycheck-info-unnecessary [79 times]. Don't know if that is related.

@vikigenius vikigenius added the bug label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant