Skip to content

ENH: infer language driving the kernel and update syntax #16

@sglyon

Description

@sglyon

Disclaimer: this might be unfeasible because it might involve dynamic changes to tmLanguage files.

Now that there are more and more languages implementing ipython kernels (Julia, Go, Haskell, ...), it might make sense to expand the syntax highlighting (and by extension all the snipets/completions, ect. provided by sublime) for code cells. This would involve changing this line of SublimeIPythonNotebook.tmLanguage to be updated dynamically based on the metadata given at the top of the .ipynb JSON file.

For example, when using IJulia (ipython with julia backend), the first few lines of the .ipynb are

{
 "metadata": {
  "language": "Julia",
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [

whereas with a normal python based notebook we have

{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [

Actually changing the line would be easy, but the question we need to ask is whether or not we would be worried about corrupting the tmLanguage source or introducing a security issue by allowing this file to be dynamically updated.

I guess another option would be to have different tmLanguage files for each type of backend (they would be copy/paste of one another with minor changes) and we would somehow instruct sublime on which one to use based on the backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions