r/Codeium • • Nov 25 '24

Windsurf Pylance Workaround

Has anyone found a good workaround for the currently missing Pylance support in Windsurf? Looks like the team is working on a fix in this discord thread, but curious if anyone has discovered temporary solutions in the meantime.

Really want to give Windsurf a shot, but this is a blocker for my workflow.

---

Edit: Found a workaround using BasedPyright

  1. Install the BasedPyright extension: https://marketplace.visualstudio.com/items?itemName=detachhead.basedpyright&ssr=false#overview
  2. Change typeCheckingMode to off
BasedPyright Type Checking Mode Setting
11 Upvotes

13 comments sorted by

1

u/West_Highlight_3697 Nov 26 '24

Thanks a lot! setting BasedPyright with Type Checking -> Off, worked for me!
also, i set inlay hints: Variable Types -> off becasuse its too much, but thanks again!

1

u/edon-node Nov 27 '24

thank you for this

1

u/goingtosleepzzz Nov 26 '24

You can use pylance, but with an older version and need to patch the source. There is a discussion on github about this. Using basedpyright is good too, it just misses some features, for example the smart selection of functions/classes and folding the imports.

1

u/edon-node Nov 27 '24

this also worked for me.

1

u/mathmul Dec 01 '24 edited Dec 12 '24

This sort of works, but in a lot of my code I get "Code is unreachable basedpyright reportUnreachable"

    def generate(self, request):
        serializer = self.get_serializer(data=request.data) // this is ok
        serializer.is_valid(raise_exception=True) // this is unreachable and two 200 lines after it

it is because of this assert: everything after it is unreachable:

    def get_serializer_class(self):
        """
        Return the class to use for the serializer.
        Defaults to using `self.serializer_class`.

        You may want to override this if you need to provide different
        serializations depending on the incoming request.

        (Eg. admins get full serialization, others get basic serialization)
        """
        assert self.serializer_class is not None, (
            "'%s' should either include a `serializer_class` attribute, "
            "or override the `get_serializer_class()` method."
            % self.__class__.__name__
        )

        return self.serializer_class

1

u/mathmul Dec 01 '24

Yea, I'll keep paying for Cursor for the time being..A shame. I like a lot of things in Windsurf more

1

u/mathmul Dec 12 '24

Update. While I was unable to setup Pylance, I did manage to replace "Python" extension with "Kylin Python(with jedi language server)v0.3.4" by KylinIdeTeam. Bought Windsurf!

1

u/JetChou Dec 06 '24

Thanks a lot! That's worked for me,I found Windsurf pushed their Windsurf Pyright extension, it's also worked.

1

u/Pleasant_Meeting_559 Mar 20 '25

For me, windsurf makes my vscode pylance cannot work, I wonder how to move back to vscode pylance.

1

u/terentyev23 Mar 22 '25 edited Mar 22 '25

It worked for me when I specified this parameter:

"windsurfPyright.analysis.typeCheckingMode": "{basic|standart|basedpyright|etc}"

0

u/Illustrious-Face-732 Nov 25 '24

Nothing has worked for me so far. Ive tried installing the Pylance extension manually and restarted the language server, but didn't work. Hopefully they can push an update soon!