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

Syntax Highlighting for Julia in VS Code not working at all and broken in VS Code Insider #5237

Closed
no-trick-pony opened this issue Mar 22, 2021 · 6 comments
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@no-trick-pony
Copy link

no-trick-pony commented Mar 22, 2021

I reported this issue first on Julia discourse here: https://discourse.julialang.org/t/running-julia-jupyter-notebooks-inside-vscode/47421/13?u=manuel_bergmann
I am copying this over here:

I am currently on the stable version 1.53.2 of VSCode with Julia 1.5.3 and I have the exact same issues with it as described previously in the thread: Code runs, but no syntax highlighting and also only old UI.
Installed versions:

  • VSCode (stable) 1.53.2
  • Julia (on the system): 1.5.3
  • Julia VS extension: 1.1.32
  • Jupyter VS extension: v2021.2.603412351
  • Platform: Windows 10
  • Running: Locally
  • Python: 3.8.2

image

Again, with the current VS Code Insider version this works. Kinda. The syntax highlighting in many cases seems broken, especially string interpolations.

  • VSCode (insider) 1.55.0
  • Julia (on the system): 1.5.3
  • Julia VS extension: 1.1.37
  • Jupyter VS extension: v2021.4.641214696
  • Platform: Windows 10
  • Running: Locally
  • Python: 3.8.2

image

Note the 2pi marked red as well as the syntax highlighting for the string interpolation being broken.
All those things work in regular .jl files in VS Code however:

image

Out of interest I tried the string interpolation in nteract as well and here it was completely broken too (but in a different way):

image

Am I missing something?

@no-trick-pony no-trick-pony added the bug Issue identified by VS Code Team member as probable bug label Mar 22, 2021
@no-trick-pony no-trick-pony changed the title Syntax Highlighting in VS Code not working and broken in VS Code Insider Syntax Highlighting for Julia in VS Code not working at all and broken in VS Code Insider Mar 22, 2021
@DavidKutu
Copy link

Thanks for the issue @no-trick-pony. We haven't specifically supported other kernels in the stable version of notebooks (although its possible to use it). That support is for the new native notebook you're using in insiders.

Unfortunately, I couldn't repro your issue with the same version of VS code insiders and the Jupyter extension:
image

As far as I know, that highlighting is expected. I do have a few questions for you:

  • Does this happen in other languages?
  • Could you test your Julia notebook with the Julia extension disabled?

Please let me know what happens.

@DavidKutu DavidKutu added the info-needed Issue requires more information from poster label Mar 23, 2021
@no-trick-pony
Copy link
Author

Thanks a lot for your help - I found out what the issue was: For some reason, the syntax highlighting in Insiders defaulted to Python even though the Julia kernel was used and run for the whole notebook. I honestly didn't even know this is configurable. Is there a setting to change this permanently? Thanks a lot for your help! :)

Regarding the current VS Code version, I was able to find this: julia-vscode/julia-vscode#1620 (comment) which suggests the issue is known and has to be manually fixed. Since this answers all my questions/is dealing with issues already reported I close this ticket.

Thanks again for your help and your efforts! :)

@jlperla
Copy link

jlperla commented Mar 23, 2021

@rchiodo FYI

@no-trick-pony
Copy link
Author

no-trick-pony commented Mar 23, 2021

Adendum: I closed and saved the notebook after I set the syntax to Julia for every cell and after reopening it, every cell was set to Python again. This can be reproduced on my machine for this notebook and happens every time and I have to set "Julia" as the language on every single cell on its own.
I think I found the issue: A notebook created with current stable VS Code will integrate the following metadata, regardless of what kernel was used:

 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": 3
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "julia-1.5",
   "display_name": "Julia 1.5.3",
   "language": "julia"
  }
 },

Opening this file in VS-Code Insiders with the Jupyter extension seems to interpret this. Saving it there does not seem to overwrite it, so regardless of what kernel or per-cell language setting you use, it will still display everything as Python the next time you open the notebook. (Sidenote: Selecting a kernel seems to have vanished into the menu and is not an overlay anymore, or I am just blind). The per-cell language highlighting does not seem to be persisted at all.
I am not really experienced with Jupyter notebooks besides using them here and there, so I can't give much input on this, other than you should probably take another look at it (if there is a "this notebook should be language X setting I haven't found it yet ^^"), otherwise opening "old" (or others') notebooks with the new VSCode/Jupyter might get painful for anything else other than Python.
Thanks again for your help

@rchiodo
Copy link
Contributor

rchiodo commented Mar 23, 2021

I closed and saved the notebook after I set the syntax to Julia for every cell and after reopening it, every cell was set to Python again

This is actually a known issue. This bug here: #5148

@rchiodo
Copy link
Contributor

rchiodo commented Mar 23, 2021

I'm going to enter a new issue for this part:

A notebook created with current stable VS Code will integrate the following metadata, regardless of what kernel was used:

 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": 3
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "julia-1.5",
   "display_name": "Julia 1.5.3",
   "language": "julia"
  }
 },

I want to make sure our insiders version is not doing the same thing.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants