jupyterlab-lsp icon indicating copy to clipboard operation
jupyterlab-lsp copied to clipboard

[wip] add settings-based code extractors

Open bollwyvl opened this issue 1 year ago • 3 comments
trafficstars

References

  • fixes #1079

Code changes

  • [x] adds cellTypes to RegExpForeignCodeExtractor.IOptions
  • [x] adds schema/transclusions.json to define a simplified extractor
  • [x] adds ILSPCustomTransclusionsManager token

User-facing changes

  • users will be able to add new extractors from the Settings Editor

Backwards-incompatible changes

  • n/a

Chores

  • [x] linted
  • [ ] tested
  • [ ] documented
  • [ ] changelog entry

bollwyvl avatar Apr 22 '24 14:04 bollwyvl

Binder :point_left: Launch a binder notebook on branch bollwyvl/jupyterlab-lsp/gh-1079-settings-code-extractors

github-actions[bot] avatar Apr 22 '24 14:04 github-actions[bot]

As of opening this PR, things kinda work, e.g. this naive extractor finding <script> tags inside .md files and markdown cells:

{
  "enabled": true,
  "codeExtractors": {
    "md-js-script": {
      "hostLanguage": "ipythongfm",
      "foreignLanguage": "javascript"
      "pattern": "<script>((.|\n)*?(?=</script>))</script>",
      "foreignCaptureGroups": [1],
      "fileExtension": "js",
      "cellTypes": ["code", "markdown"],
      "isStandalone": false,
    }
  }
}

Kinda, in that while diagnostics work, completion, go to definition, and others do not appear to work, but i haven't debugged further.

The internal state of the upstream manager (and the extractor itself) is kind of hard to reason about, and generally requires a full page reload after making any changes.

bollwyvl avatar Apr 22 '24 14:04 bollwyvl

image

bollwyvl avatar Apr 22 '24 14:04 bollwyvl