Closed yelled1 closed 6 years ago
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
Now I see that this conflicts w/ "Insert Line Below" that's seems to b the prb. Still, Even "Insert Line Below" removed, still causes problems
ExpandLineSelection has the correct behavior, it selects the line and the insertion point is on the next line, so that you can select multiple lines be repeatedly entering CTRL+i. This behaviour will not change.
I suggest you adapt your macros and use other steps to select the current line.
If it selected the line & moved the insertion point to next line then 2 lines should been executed? It does not seem to select the current line (where the cursor is loc) at all. This was working on the order version. Plus, when I select multiple lines by highlighting multiple lines, "workbench.action.terminal.runSelectedText" seems to only execute the last line, where the cursor is resting. "workbench.action.terminal.runSelectedText" is ignoring selection. Pls reopen.
When I replaced //"workbench.action.terminal.runSelectedText", with "python.execSelectionInTerminal", This works. So, it's workbench.action.terminal.runSelectedText that's broken. "macros": { "execCurLn": [ "expandLineSelection", //"workbench.action.terminal.runSelectedText", "python.execSelectionInTerminal", "cancelSelection" ], "execCurSel": [ "python.execSelectionInTerminal", //"workbench.action.terminal.runSelectedText", "cancelSelection" ],
@yelled1 Can you please give simple, precise steps?
From the following list: expandLineSelection
, workbench.action.terminal.runSelectedText
, python.execSelectionInTerminal
, cancelSelection
.
Which one of these commands misbehaves in your opinion, and why? Can you please give a simple example where you show what occurs vs what you believe should occur.
Hi:
After downloading ms-python.python & geddski.macros Pls add following to UserSettings "macros": { "execCurLnPy": [ "expandLineSelection", "python.execSelectionInTerminal", "cancelSelection" ], "execCurSelPy": [ // "cursorDown", //"expandLineSelection", "python.execSelectionInTerminal", "cancelSelection", ],
"execCurLn": [ "expandLineSelection", "workbench.action.terminal.runSelectedText", "cancelSelection" ], "execCurSel": [ "workbench.action.terminal.runSelectedText", "cancelSelection", ], },
and add following to keybinds.json { "key": "ctrl+enter", "command": "-editor.action.insertLineAfter", "when": "editorTextFocus && !editorReadonly" }, { "key": "ctrl+enter", "command": "macros.execCurSelPy", "when": "editorTextFocus && editorHasSelection && editorLangId == 'python'" }, { "key": "ctrl+enter", "command": "macros.execCurLnPy", "when": "editorTextFocus && !editorHasSelection && editorLangId == 'python'" },
{ "key": "ctrl+enter", "command": "macros.execCurSel", "when": "editorTextFocus && editorHasSelection && editorLangId != 'python'"}, { "key": "ctrl+enter", "command": "macros.execCurLn", "when": "editorTextFocus && !editorHasSelection && editorLangId != 'python'"} ]
Now highlight a python script like import pandas as pd from matplotlib import pyplot as plt import seaborn as sns
url = 'https://elitedatascience.com/wp-content/uploads/2017/04/Pokemon.csv' df = pd.read_csv('Pokemon.csv', index_col=0, encoding = "ISO-8859-1")
and hit ctrl-enter You will get something like
hyoon@Gibyte0:/media/BK5/DFS/Prj/LearnPy/Pandas$ source activate SPk (SPk) hyoon@Gibyte0:/media/BK5/DFS/Prj/LearnPy/Pandas$ /opt/miniconda3/envs/SPk/bin/python Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import pandas as pd from matplotlib import pyplot as plt import seaborn as sns
url = 'https://elitedatascience.com/wp-content/uploads/2017/04/ Pokemon.csv' df = pd.read_csv('Pokemon.csv', index_col=0, encoding = "ISO-8859-1")
Now try: using DataFrames
array1 = [1,2,3] array2 = [1 2 3] array1' == array2 array1' === array2 array3 = [1,2,3.] array4 = [[1,2,3] [4,5,6] [7,8,9]] # 3x3 ; 9 array5 = [[1,2,3], [4,5,6], [7,8,9]] # [3]x3; 3 array6 = [[1,2,3]; [4,5,6]; [7,8,9]] # 9 length(array6) Hit ctrl-enter You will realize that next line executes rather than one that's currently on Visualizing by highlighting seems to yield erratic behaviors. Sometimes the code does not even execute & other times wrong lines get executed.
Thank you much,
On Mon, Feb 26, 2018 at 4:30 AM, Alexandru Dima notifications@github.com wrote:
@yelled1 https://github.com/yelled1 Can you please give simple, precise steps?
From the following list: expandLineSelection, workbench.action.terminal. runSelectedText, python.execSelectionInTerminal, cancelSelection.
Which one of these commands misbehaves in your opinion, and why? Can you please give a simple example where you show what occurs vs what you believe should occur.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/43822#issuecomment-368439781, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNR1gJiZCgUfTJnpq1muSLaPnlEEWfrks5tYnnIgaJpZM4SINuj .
@yelled1 I have followed all of your steps and it appears to work fine for me:
ms-python.python
and geddski.macros
"macros": {
"execCurLnPy": [
"expandLineSelection",
"python.execSelectionInTerminal",
"cancelSelection"
],
"execCurSelPy": [
// "cursorDown",
//"expandLineSelection",
"python.execSelectionInTerminal",
"cancelSelection",
],
"execCurLn": [
"expandLineSelection",
"workbench.action.terminal.runSelectedText",
"cancelSelection"
],
"execCurSel": [
"workbench.action.terminal.runSelectedText",
"cancelSelection",
],
},
keybindings.json
:
{
"key": "ctrl+enter",
"command": "-editor.action.insertLineAfter",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+enter",
"command": "macros.execCurSelPy",
"when": "editorTextFocus && editorHasSelection && editorLangId == 'python'"
},
{
"key": "ctrl+enter",
"command": "macros.execCurLnPy",
"when": "editorTextFocus && !editorHasSelection && editorLangId == 'python'"
},
{
"key": "ctrl+enter",
"command": "macros.execCurSel",
"when": "editorTextFocus&& editorHasSelection && editorLangId != 'python'"
},
{
"key": "ctrl+enter",
"command": "macros.execCurLn",
"when": "editorTextFocus && !editorHasSelection && editorLangId != 'python'"
}
using DataFrames
array1 = [1,2,3] array2 = [1 2 3] array1' == array2 array1' === array2 array3 = [1,2,3.] array4 = [[1,2,3] [4,5,6] [7,8,9]] # 3x3 ; 9 array5 = [[1,2,3], [4,5,6], [7,8,9]] # [3]x3; 3 array6 = [[1,2,3]; [4,5,6]; [7,8,9]] # 9 length(array6) length(array1)
5. I move the cursor around, and I press <kbd>ctrl</kbd>+<kbd>enter</kbd>
6. I see executed the line on which the cursor rests:
![kapture 2018-02-27 at 15 12 21](https://user-images.githubusercontent.com/5047891/36733368-a66f3994-1bd0-11e8-984e-a1adaea75499.gif)
P.S. For formatting reasons, please comment using the GitHub UI at https://github.com/Microsoft/vscode/issues/43822
Oh, Python is fine. It's just anything else (other languages) with
"command": "macros.execCurSel",
That fails. Julia / Scala is what I tested on but I am pretty sure even bash will b same. Sorry, should have made that clear.
On Tue, Feb 27, 2018 at 9:14 AM, Alexandru Dima notifications@github.com wrote:
@yelled1 https://github.com/yelled1 I have followed all of your steps and it appears to work fine for me:
- I have installed ms-python.python and geddski.macros
- I have added the following to my settings:
"macros": { "execCurLnPy": [ "expandLineSelection", "python.execSelectionInTerminal", "cancelSelection" ], "execCurSelPy": [ // "cursorDown", //"expandLineSelection", "python.execSelectionInTerminal", "cancelSelection", ], "execCurLn": [ "expandLineSelection", "workbench.action.terminal.runSelectedText", "cancelSelection" ], "execCurSel": [ "workbench.action.terminal.runSelectedText", "cancelSelection", ], },
- I have added the following to my keybindings.json:
{ "key": "ctrl+enter", "command": "-editor.action.insertLineAfter", "when": "editorTextFocus && !editorReadonly" }, { "key": "ctrl+enter", "command": "macros.execCurSelPy", "when": "editorTextFocus && editorHasSelection && editorLangId == 'python'" }, { "key": "ctrl+enter", "command": "macros.execCurLnPy", "when": "editorTextFocus && !editorHasSelection && editorLangId == 'python'" }, { "key": "ctrl+enter", "command": "macros.execCurSel", "when": "editorTextFocus&& editorHasSelection && editorLangId != 'python'" }, { "key": "ctrl+enter", "command": "macros.execCurLn", "when": "editorTextFocus && !editorHasSelection && editorLangId != 'python'" }
- I have created a Python file:
using DataFrames
array1 = [1,2,3] array2 = [1 2 3] array1' == array2 array1' === array2 array3 = [1,2,3.] array4 = [[1,2,3] [4,5,6] [7,8,9]] # 3x3 ; 9 array5 = [[1,2,3], [4,5,6], [7,8,9]] # [3]x3; 3 array6 = [[1,2,3]; [4,5,6]; [7,8,9]] # 9 length(array6) length(array1)
- I move the cursor around, and I press ctrl+enter
- I see executed the line on which the cursor rests: [image: kapture 2018-02-27 at 15 12 21] https://user-images.githubusercontent.com/5047891/36733368-a66f3994-1bd0-11e8-984e-a1adaea75499.gif
P.S. For formatting reasons, please comment using the GitHub UI at #43822 https://github.com/Microsoft/vscode/issues/43822
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/43822#issuecomment-368890744, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNR1rECRnHxQlLsnDalow2S63FnEDdNks5tZA3igaJpZM4SINuj .
@yelled1 This is a problem with the geddski.macros
extension. Please create an issue against that extension at https://github.com/geddski/macros.
I can reproduce. When pressing ctrl+enter in a bash file, the command that will be executed will be macros.execCurLn
. That one appears to be configured by you to be a series of commands:
"execCurLn": [
"expandLineSelection",
"workbench.action.terminal.runSelectedText",
"cancelSelection"
]
I believe this to be a problem with the geddski.macros
extension, because when I write a hard-coded version of invoking the commands in an extension, everything functions correctly:
package.json
:
{
"publisher": "alex",
"name": "43822",
"version": "0.0.1",
"engines": { "vscode": "^1.0.0" },
"activationEvents": [ "*" ],
"main": "index.js",
"contributes": { "commands": [ { "command": "repro.43822", "title": "Run Repro 43822" } ] }
}
index.js
:
const vscode = require('vscode');
exports.activate = function() { vscode.commands.registerCommand('repro.43822', function() { vscode.commands.executeCommand('expandLineSelection').then(function() { vscode.commands.executeCommand('workbench.action.terminal.runSelectedText').then(function() { vscode.commands.executeCommand('cancelSelection'); }); }); }); }
![kapture 2018-02-27 at 17 11 24](https://user-images.githubusercontent.com/5047891/36739854-45df8046-1be1-11e8-99a5-e87191a29df8.gif)
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes/No Can't do as I am using macros 1.2.1 to run this.