valentjn / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
800 stars 27 forks source link

Jupyter Notebook (.ipynb) support #852

Closed AndhikaWB closed 1 year ago

AndhikaWB commented 1 year ago

Note: Per the contribution guidelines, deleting parts of the template or not filling in vital information may result in the issue to be immediately closed as invalid.

Is your feature request related to a problem? Please describe. Is Jupyter Notebook file supported at all? Jupyter Notebook (*.ipynb) is basically just a json file that can embed code (usually Python) and markdown within it. It's currently unsupported by the extension (I think?), and it's impossible to add it via ltex.enabled because it's not registered as a language identifier. I tried adding something like this but all of them has no effect:

{
    "ltex.enabled": [
        "*.ipynb",
        ".ipynb",
        "ipynb",
        "bibtex",
        "context",
        "context.tex",
        "html",
        "latex",
        "markdown",
        "org",
        "restructuredtext",
        "rsweave"
    ]
}

Describe the solution you'd like I considered few solutions, some are harder to maintain or implement:

  1. Add full support for Jupyter Notebook by treating it as it's own language (not as python and/or markdown)
  2. Add plain extension support for ltex.enabled (e.g. by recognizing format such as *.ipynb) by treating it as plaintext?
  3. Add alias support for recognizing Jupyter Notebook file as something else, e.g. ltex.alias?
    "ltex.alias": {
        "ipynb": "plaintext"
    }

Describe alternatives you've considered There is one other solution that may be the simplest to implement:

  1. Register Jupyter Notebook as a language identifier (so it can be listed in ltex.enabled). This solution is quite ugly because it doesn't have anything to do with Jupyter Notebook itself (other than for checking grammar, etc), but probably more simple to implement.

Additional context If you don't know about Jupyter Notebook, you can check some example files (*.ipynb) from my repos. Github may not display it as json file though, so you may need to view it as raw file.

AndhikaWB commented 1 year ago

Never mind, it looks like it actually works for the markdown but only in edit mode. For Python cells it's disabled by default so I need to add python in ltex.enabled.