getcursor / cursor

The AI Code Editor
https://cursor.com
23.16k stars 1.47k forks source link

Pylance does not work with cursor #1569

Open naingthet opened 1 month ago

naingthet commented 1 month ago

As of the latest update, I have been completely unable to use pylance with cursor IDE. Here are the error logs from Pylance output:

2024-07-26 12:41:24.731 [info] [Info  - 12:41:24 PM] (28818) Pylance language server 2024.7.102 (pyright version 1.1.372, commit d6372d45) starting
2024-07-26 12:41:24.731 [info] [Info  - 12:41:24 PM] (28818) Server root directory: file:///Users/thet/.cursor/extensions/ms-python.vscode-pylance-2024.7.102/dist
2024-07-26 12:41:24.732 [info] [Error - 12:41:24 PM] Server initialization failed.
2024-07-26 12:41:24.732 [info]   Message: Request initialize failed with message: You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.

  Code: -32603 
RamlahAziz commented 1 month ago

Same issue here. Seems to be related to using pylance out of VS code. I was getting this error:

2024-08-05 11:20:35.522 [info] [Info  - 11:20:35 AM] (13107) Pylance language server 2024.7.1 (pyright version 1.1.369, commit 1168be71) starting
2024-08-05 11:20:35.585 [info] [Info  - 11:20:35 AM] (13107) Server root directory: file:///home/ramlah/.cursor/extensions/ms-python.vscode-pylance-2024.7.1/dist
2024-08-05 11:20:35.591 [info] [Error - 11:20:35 AM] Server initialization failed.
2024-08-05 11:20:35.591 [info]   Message: Request initialize failed with message: You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.
  Code: -32603 
2024-08-05 11:20:35.592 [info] [Error - 11:20:35 AM] Pylance client: couldn't create connection to server.
2024-08-05 11:20:35.592 [info]   Message: Request initialize failed with message: You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.
  Code: -32603

Update: What fixed this for me was going to the extensions tab and restarting the python / pylance extensions

naingthet commented 1 month ago

Unfortunately, that did not fix it for me, but using https://github.com/DetachHead/basedpyright seems to work fine.