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

Codelens Support in julia Files #3586

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

huangyxi
Copy link

This PR attempts to support CodeLens for julia files (#858), enabling users to explore and execute code cells directly in the editor.

image

The initial commit only demonstrates the availability of CodeLens for julia files. To implement the complete functionality, there are two more tasks to be done.

  1. Currently, the julia.executeCell command is used to execute code cells. However, the range of the code cell is reliant on the pointer position, where the trigger of CodeLens actions may not enclose the current pointer position.
    const selection = ed.selection
    const cellrange = currentCellRange(ed)

To address this issue, I propose two separate approaches:

  • Workaround: Modify the julia.executeCell command to execute either the code cell enclosing the pointer position or the code cell enclosing the CodeLens trigger position.
  • General solution: Strip and refactor all source code related to code cell execution to a more general approach used in the vscode-R extension (https://github.com/REditorSupport/vscode-R/blob/master/src/rmarkdown/chunks.ts). The new approach will statically analyze delimiters of all code cells and then dynamically locate the active code cell based on the executed CodeLens or pointer position. Though this approach may require more computation resources, it may provide a more robust and flexible solution for code cell execution.

I would like to hear the community's opinion on this issue. Either way, I'm willing to implement the solution.

  1. To introduce a new command julia.executeAboveCells to execute all code cells above the current pointer position if the second solution above is adopted, which is also a common feature in Jupyter notebooks and vscode-R extension.

@pfitzseb
Copy link
Member

I didn't look at the linked implementation in detail, but that second approach seems preferable.

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

Successfully merging this pull request may close these issues.

None yet

2 participants