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

Feature request: Run multiple selections by cursors #1194

Open
kylebarron opened this issue Jan 17, 2018 · 3 comments
Open

Feature request: Run multiple selections by cursors #1194

kylebarron opened this issue Jan 17, 2018 · 3 comments
Labels
discussion 💬 Discussion is wanted enhancement 🌟 New feature ideas help wanted Help is desired

Comments

@kylebarron
Copy link
Contributor

If multiple selections are highlighted, run each of them sequentially. I.e. instead of:

image

It would be:
image

@kylebarron
Copy link
Contributor Author

If I were to submit a PR for this, would this be considered? Or is this behavior not desired?

@BenRussert
Copy link
Member

Hi @kylebarron, sorry for the late response.

I just realized it looks like you have multiple cursors in your screenshot, something we don't currently handle. If this is something you would like to improve, I would be interested in a way to handle that if you sent a PR.

Otherwise, my take is that for individual cursor selections the way things work now are consistent with Jupyter platforms that separate output by cells. The intended way to get multiple outputs in hydrogen is to include cell markup in your code file.

https://nteract.gitbooks.io/hydrogen/docs/Usage/GettingStarted.html#hydrogen-run-cell

@kylebarron kylebarron changed the title Feature request: Run multiple selections Feature request: Run multiple selections by cursors Jul 16, 2018
@kylebarron
Copy link
Contributor Author

@BenRussert As an example, I often want to debug functions for which I have default values, and my ideal way of initially defining those values would be like this:

peek 2018-07-16 16-41

This isn't really a situation where run-cell would be useful, because only occasionally do I want to run the multiple selections, and it would seem that run-cell would run the entire function, not the localized selections.

I'm guessing that the best way to implement this would be by changing codeManager.findCodeBlock()?

export function findCodeBlock(editor: atom$TextEditor) {
const selectedText = getSelectedText(editor);
if (selectedText) {
const selectedRange = editor.getSelectedBufferRange();
let endRow = selectedRange.end.row;
if (selectedRange.end.column === 0) {
endRow -= 1;
}
endRow = escapeBlankRows(editor, selectedRange.start.row, endRow);
return [selectedText, endRow];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion 💬 Discussion is wanted enhancement 🌟 New feature ideas help wanted Help is desired
Projects
None yet
Development

No branches or pull requests

3 participants