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

add a way to declare a cell and a command run cell #191

Closed
stevenlis opened this issue Jan 17, 2020 · 8 comments · Fixed by #662
Closed

add a way to declare a cell and a command run cell #191

stevenlis opened this issue Jan 17, 2020 · 8 comments · Fixed by #662

Comments

@stevenlis
Copy link

Please considering add a way to declare a cell like #%% so that users can run code from cell to cell without selecting multiple lines of code.

example:
https://code.visualstudio.com/docs/python/jupyter-support-py#_jupyter-code-cells
https://nteract.gitbooks.io/hydrogen/

@andycraig
Copy link
Collaborator

Hi @StevenLi-DS, thank you for the suggestion. Using Ctrl-Enter sends multiple lines of code if they’re linked together by brackets or pipes etc. but being able to declare cells would enable more control over what constitutes a sendable block of code.

I’ll put this as ‘help wanted’.

@assignUser
Copy link
Contributor

assignUser commented Aug 13, 2020

I would suggest implementing this in a way that makes it compatible with rstudio sections: https://support.rstudio.com/hc/en-us/articles/200484568-Code-Folding-and-Sections
e.g. # Section ----
To allwo easier conversion from rstudio to vsc :)

This would also make it possible to add a code navigation feature from rstudio that generates a "table of contents" via the code sections.
Latex-Workshop does the same in the sidebar:
image
Maybe it is possible to use some of their code?

@renkun-ken
Copy link
Member

@assignUser

Code section is already implemented in languageserver by REditorSupport/languageserver#163 and folding by REditorSupport/languageserver#294.

@renkun-ken
Copy link
Member

renkun-ken commented Aug 13, 2020

Regarding the original request here, cell-based approach is more supported by the Notebook API to have code cells suggested at #378 and being implemented at #394.

It is also possible to support in-document cells similar with vscode-python's. It looks like we might need to take a look at the APIs of editor decoration and code actions.

@assignUser
Copy link
Contributor

@renkun-ken Oh that's cool! Sorry for my superflous comment, vsc-r/lsp can do so much I am still learning everyday. Thank you for your work on these projects.

@renkun-ken
Copy link
Member

renkun-ken commented Jan 5, 2021

With rmarkdown code chunks support implemented, this code chunk in R script should be straightforward.

@ElianHugh
Copy link
Collaborator

If this is something people are still interested in, I have this working by piggybacking on rmarkdown.ts like @renkun-ken suggested:

HluveJQPU8

Still needs a little polishing, but is functioning as expected

@renkun-ken
Copy link
Member

@ElianHugh Thanks for working on this. I believe it is still quite useful. It would be nice for you to put it into a PR anytime you like.

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

Successfully merging a pull request may close this issue.

5 participants