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

Repl --run Output Notebook Crashes VS Code C# Language Server #88

Open
andy-merrick opened this issue Aug 26, 2023 · 1 comment
Open

Comments

@andy-merrick
Copy link

andy-merrick commented Aug 26, 2023

Issue Type: Bug

Description: Using --run with inputs causes the ipynb output file to crash the C# Language Server in VS Code when opening with Polyglot Notebooks v1.0.4403010 resulting in the notebook's Output cells being cleared. Possible fix below.

Command

dotnet-repl --run input.ipynb --exit-after-run --input id=1 --output-path output.ipynb

Repro Files

VS Code C# Terminal Output Error

[LanguageServerHost]System.InvalidOperationException: didOpen received for vscode-notebook-cell:/c:/Users/xxxxxxxxxxx/repos/polyglot/playground/dotnet-repl-error/dotnet-repl-output.ipynb#W1sZmlsZQ== which is already open. - line 106
   at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber) in /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/Contract.cs:line 154
...
...

Cause

dotnet-repl writes the following json key into the output file:

"language_info": {
   "file_extension": ".cs",
   "mimetype": "text/x-csharp",
   "name": "C#",
   "pygments_lexer": "csharp",
   "version": "10.0"
},

Fix

Replacing this key with how VS Code writes it results in the dotnet-repl file successfully loading in VS Code:

"language_info": {
    "name": "polyglot-notebook"
},
@andy-merrick andy-merrick changed the title --run Output Notebook Crashes VS Code C# Language Server Repl --run Output Notebook Crashes VS Code C# Language Server Aug 26, 2023
@jonsequitur
Copy link
Owner

This sounds like a bug in the language server. The language_info node you pasted under Cause is the more correct one, per the .ipynb spec.

Do you know which extension is running this language server? (It's not Polyglot Notebooks.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants