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

Error when changing language to Python for unsaved file #737

Closed
CrazyIvan359 opened this issue Dec 15, 2020 · 2 comments
Closed

Error when changing language to Python for unsaved file #737

CrazyIvan359 opened this issue Dec 15, 2020 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@CrazyIvan359
Copy link

CrazyIvan359 commented Dec 15, 2020

Environment data

  • Language Server version: 2020.12.2
  • OS and version: Ubuntu 20.04
  • Python version: 3.8.5 64-bit

Expected behaviour

Language server should either support unsaved files (not sure how feasible that is) or not attempt to parse them. Perhaps a notification could indicate this?

Actual behaviour

Language server crashes when specifying the language of an unsaved file as Python.

Logs

(node:2548735) UnhandledPromiseRejectionWarning: Error: Debug Failure. Untitled-1 is not a source file
    at P._addToSourceFileListAndMap (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/analyzer/program.ts:2075:13)
    at P.setFileOpened (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/analyzer/program.ts:275:18)
    at O.setFileOpened (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts:90:23)
    at d.setFileOpened (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/analyzer/service.ts:192:41)
    at Y.<anonymous> (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/languageServerBase.ts:789:39)
    at Generator.next (<anonymous>)
    at o (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright.bundle.js:1:584031)
(node:2548735) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Error: Debug Failure. Untitled-1 is not a source file
    at P._addToSourceFileListAndMap (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/analyzer/program.ts:2075:13)
    at P.setFileOpened (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/analyzer/program.ts:275:18)
    at B.onMessage (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/backgroundAnalysisBase.ts:366:30)
    at B.onMessage (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/server.bundle.js:1:32759)
    at MessagePort.<anonymous> (/home/mike/.vscode/extensions/ms-python.vscode-pylance-2020.12.2/dist/pyright-internal/src/backgroundAnalysisBase.ts:273:66)
    at MessagePort.emit (events.js:223:5)
    at MessagePort.onmessage (internal/worker/io.js:70:8)
Background analysis message: setFileOpened

I enabled trace logging, but no additional messages were produced.

@erictraut
Copy link
Contributor

I'm able to repro this with Pylance but not with the Pyright VS Code extension. I suspect it has to do with the interaction between the core Python extension and Pylance.

@jakebailey
Copy link
Member

Marking this as a duplicate of #739, which is all the same issue.

@jakebailey jakebailey added the duplicate This issue or pull request already exists label Dec 15, 2020
@github-actions github-actions bot removed the triage label Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants