type mismatch: base parameter is type "Any", override parameter is type "Any"
When creating a new plugin with a text command and adding a type annotation to run() method, an error appears in the Diagnostics panel:
buffer://sublime/150:
6:7 error Method "run" overrides class "TextCommand" in an incompatible manner Pyright: reportIncompatibleMethodOverride
Parameter 2 type mismatch: base parameter is type "Any", override parameter is type "Any"
code:
from typing import Any
import sublime_plugin
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit: Any):
self.view.insert(edit, 0, "Hello, World!")
LSP-pyright 1.1.136
I can't reproduce this with your code. No matter it's a saved file or a buffer (from Tools > Developer > New Plugin). Though I don't think this issue comes from here.
Not the cause, but it should be edit: sublime.Edit.
Tested on a clean portable Sublime Text (installed only LSP and LSP-pyright packages) - got the same error.

I know that it should be sublime.Edit, but I just tried to annotate it to the Any type so that all errors are gone, but instead I got a cryptic error saing type Any is incompatible with type Any. Maybe it's a pyright type checker issue?
Tested on a clean portable Sublime Text (installed only LSP and LSP-pyright packages) - got the same error.
Not reproduce-able.
https://user-images.githubusercontent.com/6594915/152478192-cdb4c348-5b72-4f93-9616-c9b1ee8d2418.mp4
Sorry, I forgot to mention the setting "python.analysis.typeCheckingMode": "strict" that enables the reportIncompatibleMethodOverride rule.
Sorry, I forgot to mention the setting
"python.analysis.typeCheckingMode": "strict"that enables thereportIncompatibleMethodOverriderule.
Yes, that's the reason. But I have no idea how to fix that unfortunately since run accepts literally any amount of any arguments, which I guess "strict" doesn't like.
class TextCommand(Command):
run: Callable[..., None]
If someone comes up a solution, I am definitely welcome. Just open a pull request 😄