You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create statement which assigns some value to nested property like scope.vm.renderSettings = {};
Put cursor into renderSettings
Execute command editor.action.smartSelect.grow
Expected behavior: renderSettings part would be selected
Current behavior:
the whole left part of statement selected with tabs.
Also would be nice to see the fix with smart grow, when editor.action.smartSelect.grow executed in series.
Reacted by Alex Macleod, dswwsd, Timur Manyanov, Otis Sutton, Mads Hartmann, Frederico Galvão, Fred Policarpo, Julio Cezar Silva, Fred Vatin, Mani Shooshtari and 102 more
Reacted by Anton Fedchenko, Yuri Bochkarev, Thomas Ruiz, csalv5, Travis Clarke, Alex Solomaha, bananatranada, Jakub Čábera, Taylon, Hu Jianxin and 2 more
Reacted by Yuri Bochkarev, Anton Fedchenko, Thomas Ruiz, csalv5, Travis Clarke, Brent Grossman, Alex Solomaha, bananatranada, Evgeny, Jakub Čábera and 4 more
Reacted by Christian Renardy, Kamil Dzieniszewski and Virgiel
I was too optimistic planning this for April. The current implementation is based of token/scope information in TM grammars. The issue is that each grammar does it different, like scope from above where it seems to include the leading whitespace. We redo this with a implementation that doesn't rely on token information
Reacted by Alex Macleod, Timur Manyanov, Otis Sutton, Frederico Galvão, Noitidart, Mani Shooshtari, Rotem Slootzky, Michael Andrieiev, Umut Topuzoğlu, Yuri Bochkarev and 19 more
Would it be best to have people just list out a bunch of examples, using something like the markup I just used to show the behaviour desired? Then, from those. distil the logic in regards to he AST? There's a lot of edgecases I would think, that might be easier
Reacted by Frederico Galvão, Michael Andrieiev, closertotheend, RemoteFox and Alexander Lohnau
Thanks all for the input. Note that we do not have access to the AST or any other form of syntax tree. Even token information isn't working well enough. So it's unfortunately entirely word based
I think improving smartSelect is a great plan. I agree with the suggestions for making smartSelect even more useful. Might I suggest that #11458 is solving for a different problem? I get the feeling that mixing its requirements in with smartSelect could further bog down smartSelect.
In my mind, smartSelect is about being able to quickly select something nearby the cursor. Whereas #11458 is about quickly selecting everything within a bounding context.
If smartSelect were enhanced to achieve this type of eventual selection, it would still have the downside of repeated keystrokes to achieve the "select stuff inside here" functionality.
So they feel similar because the end result is "intelligent selection" but I suspect in-the-end they would function better as separate features. Thanks for listening. :)
The value of optimal Expand Select and Shrink Select commands is high in my opinion. I used to use ReSharper in Visual Studio and their implementation was about perfect. When I use this command, I'm usually looking to copy, replace, or delete certain code.
As an example, if my selection is inside the name of a function definition ([] denotes my cursor location or selection)...
myFun[]ction(){
something.do();
}
...it should snap first to the function name...
[myFunction](){
something.do();
}
...and next to the function name with the parentheses...
[myFunction()]{
something.do();
}
...and next to the entire function block...
[myFunction(){
something.do();
}]
If my selection is inside the function, however, I would expect the progression to look something like...
myFunction(){
so[]mething.do();
}
myFunction(){
[something].do();
}
myFunction(){
[something.do()];
}
myFunction(){
[something.do();]
}
myFunction(){
[ something.do();
]}
myFunction()[{
something.do();
}]
[myFunction(){
something.do();
}]
Note that my suggestion progression has rather small steps. For instance, after selecting the expression [something.do()]; it then selects the statement [something.do();] (including the semicolon). And, in the next step, it selects the entire line. If there were multiple lines in that block, then I would suggest yet another step where it selects the entire contents of the block (before selecting the entire block including the curly braces). I prefer this more granular stepping because it's not an inconvenience to hit the left/right arrows to grow/shrink and get exactly what you want.
Reacted by Cobus Kruger, closertotheend and Andreas Linnert
Just wanted to add that it would be great for this to work with python code, where code blocks aren't delineated by brackets or parentheses, but tabs (currently, once it you expand the selection beyond the current block in a python file, all of the code is selected). I'll second that I'd like to see it work as in the Jetbrains products. In PyCharm it works great with both python and javascript files.
I have no problem with the way it currently works in JS files with VSCode.
Reacted by Olivier Grisel, Travis LaGrone, closertotheend, Nils Hjelte and Frazer Kirkman
yes, that's what I just tested. It was a miserable failure. I think the authors of this feature don't share the same vision. The way Webstorm has implemented this feature it makes it an extremely useful productivity enhancement; in vscode it's a 2-year-running exercise in frustration and disappointment.
Max Hodges (@Maxhodges) Can you please be more specific on what is lacking? This is still a work in progress, so specific feedback would probably be helpful in shaping how it ends up. This could especially be the case if, as you say, the vision differs.
The behavior in the various JetBrains IDEs is excellent in my opinion. As an example, here's the behavior for each selection increment ([] indicating the caret/selection):
Adrian (@ThiefMaster) Thanks! Something like that is not at odds with their vision and would be easily implemented with the new API. There was apparently an issue according to #64004 where the token information was not sufficient for the default provider to work like that for strings (or function calls), but the API can be used per language so it can be smarter. The issue is simply that it has not yet been implemented for that language.
While it might be possible for the default provider to be improved further, it would be best to rely on language-specific selection which will probably be adopted after the API is finalized during the current iteration. Language-specific issues should then have their own Issues so that the maintainers of their respective language extensions can address them.
Reacted by Markus, Eskild Diderichsen, Alexander and Johannes Rieken
It also doesn't work with script tags or style tags in html. It just treats it as an HTML element and selects thewhole tag, rather than the closest block.
Are you looking for contributors on this issue? Also, will the resolution deal specifically with multi-cursor support of the feature? I noted that 40516 was closed as a dupe of this issue, but I don't see anything regarding multi-cursor noted here.
Alexander Nied (@anied) The API (which was delayed) does support multiple cursors. It takes a Position[] for this purpose and returns a SelectionRange[][] which are the selection ranges for their respective input positions. I just tested with the default provider and could not reproduce losing the multiple cursors. Perhaps you could provide a more specific example where this happens.
Now I can select the '. from ('.username') and leverage Selection > Add Next Occurrence three times to get four cursors, one in each string in the arg to querySelector. However, if I now use Selection > Expand Selection, rather than selecting all four strings in their entirety I lose all additional cursors, and only '.username' is selected.
So, as far as I understand it, there remains here a bug in which expanding selection loses multi-cursor context, but perhaps I am misunderstanding or trying to execute this incorrectly.
Activity
jrieken commentedon Apr 22, 2016
I was too optimistic planning this for April. The current implementation is based of token/scope information in TM grammars. The issue is that each grammar does it different, like
scopefrom above where it seems to include the leading whitespace. We redo this with a implementation that doesn't rely on token informationjrieken commentedon Jul 5, 2016
Patrick Lienau (@rozzzly), Tobias Cudnik (@TobiaszCudnik) Since I am not as familiar with the optimal solution can you guys help out with 'how it should work?'. I guess, selector word, line?, bracket/paran-block? ...
DmytroYeremieiev commentedon Jul 5, 2016
I like the way it's implemented in https://atom.io/packages/expand-region or at Jetbrain's products like Webstorm
rozzzly commentedon Jul 13, 2016
Inner-camelCase expansion would be cool.
so let's pretend
_is the cursor, and[ ]denotes the selected region.ren_derSettings->[render]Settings->[renderSettings]Would it be best to have people just list out a bunch of examples, using something like the markup I just used to show the behaviour desired? Then, from those. distil the logic in regards to he AST? There's a lot of edgecases I would think, that might be easier
TobiaszCudnik commentedon Aug 15, 2016
Johannes Rieken (@jrieken) The simplest solution I see is to combine the AST and word separators.
Case-sensitive boundaries could be implemented as a word separator as well. In IntelliJ it works also for CTRL+Left/Right jumps, when active.
I really count for this feature, as it saves a lot of time when moving code around.
jrieken commentedon Aug 15, 2016
Thanks all for the input. Note that we do not have access to the AST or any other form of syntax tree. Even token information isn't working well enough. So it's unfortunately entirely word based
townivan commentedon Sep 7, 2016
I think improving smartSelect is a great plan. I agree with the suggestions for making smartSelect even more useful. Might I suggest that #11458 is solving for a different problem? I get the feeling that mixing its requirements in with smartSelect could further bog down smartSelect.
In my mind, smartSelect is about being able to quickly select something nearby the cursor. Whereas #11458 is about quickly selecting everything within a bounding context.
If smartSelect were enhanced to achieve this type of eventual selection, it would still have the downside of repeated keystrokes to achieve the "select stuff inside here" functionality.
So they feel similar because the end result is "intelligent selection" but I suspect in-the-end they would function better as separate features. Thanks for listening. :)
codefoster commentedon Oct 13, 2016
The value of optimal Expand Select and Shrink Select commands is high in my opinion. I used to use ReSharper in Visual Studio and their implementation was about perfect. When I use this command, I'm usually looking to copy, replace, or delete certain code.
As an example, if my selection is inside the name of a function definition ([] denotes my cursor location or selection)...
...it should snap first to the function name...
...and next to the function name with the parentheses...
...and next to the entire function block...
If my selection is inside the function, however, I would expect the progression to look something like...
Note that my suggestion progression has rather small steps. For instance, after selecting the expression
[something.do()];it then selects the statement[something.do();](including the semicolon). And, in the next step, it selects the entire line. If there were multiple lines in that block, then I would suggest yet another step where it selects the entire contents of the block (before selecting the entire block including the curly braces). I prefer this more granular stepping because it's not an inconvenience to hit the left/right arrows to grow/shrink and get exactly what you want.tony-garcia commentedon Nov 1, 2016
Just wanted to add that it would be great for this to work with python code, where code blocks aren't delineated by brackets or parentheses, but tabs (currently, once it you expand the selection beyond the current block in a python file, all of the code is selected). I'll second that I'd like to see it work as in the Jetbrains products. In PyCharm it works great with both python and javascript files.
I have no problem with the way it currently works in JS files with VSCode.
32 remaining items
Maxhodges commentedon Feb 10, 2019
yes, that's what I just tested. It was a miserable failure. I think the authors of this feature don't share the same vision. The way Webstorm has implemented this feature it makes it an extremely useful productivity enhancement; in vscode it's a 2-year-running exercise in frustration and disappointment.
KamasamaK commentedon Feb 12, 2019
Max Hodges (@Maxhodges) Can you please be more specific on what is lacking? This is still a work in progress, so specific feedback would probably be helpful in shaping how it ends up. This could especially be the case if, as you say, the vision differs.
ThiefMaster commentedon Feb 12, 2019
The behavior in the various JetBrains IDEs is excellent in my opinion. As an example, here's the behavior for each selection increment (
[]indicating the caret/selection):Like this I can step through parts I might want to change easily - and even select logical blocks (e.g. dash-separated groups) inside strings easily.
KamasamaK commentedon Feb 12, 2019
Adrian (@ThiefMaster) Thanks! Something like that is not at odds with their vision and would be easily implemented with the new API. There was apparently an issue according to #64004 where the token information was not sufficient for the default provider to work like that for strings (or function calls), but the API can be used per language so it can be smarter. The issue is simply that it has not yet been implemented for that language.
dziamid commentedon Feb 14, 2019
I find JSX expansion to be too eager:
Notice how it grows from
<Foo />straight to<div />, while I'd expect it to grow<Foo/>><Link/>><div/>Another frustration for me is attributes selection, there's currently no way to select attribute and/or all attributes of the tag:
Here it grows from
hrefto<Link />, while I'd preferhref>href="/about"> all tag attributes ><Link />bartocc commentedon Feb 14, 2019
As far as I'm concerned, I can't expand the selection for text inside javascript quotes.
It goes beyond the quotes…
kifirkin commentedon Feb 14, 2019
Use
editor.emmet.action.balanceOutinstead.KamasamaK commentedon Feb 14, 2019
While it might be possible for the default provider to be improved further, it would be best to rely on language-specific selection which will probably be adopted after the API is finalized during the current iteration. Language-specific issues should then have their own Issues so that the maintainers of their respective language extensions can address them.
Frazer commentedon Mar 2, 2019
It also doesn't work with script tags or style tags in html. It just treats it as an HTML element and selects thewhole tag, rather than the closest block.
anied commentedon Mar 9, 2019
Are you looking for contributors on this issue? Also, will the resolution deal specifically with multi-cursor support of the feature? I noted that 40516 was closed as a dupe of this issue, but I don't see anything regarding multi-cursor noted here.
KamasamaK commentedon Mar 9, 2019
Alexander Nied (@anied) The API (which was delayed) does support multiple cursors. It takes a
Position[]for this purpose and returns aSelectionRange[][]which are the selection ranges for their respective input positions. I just tested with the default provider and could not reproduce losing the multiple cursors. Perhaps you could provide a more specific example where this happens.anied commentedon Mar 9, 2019
KamasamaK - Certainly, thanks for taking the time to look into this. Here is my VSCode version info:
I just checked for updates and found none.
Consider the following code selection:
Now I can select the
'.from('.username')and leverageSelection > Add Next Occurrencethree times to get four cursors, one in each string in the arg toquerySelector. However, if I now useSelection > Expand Selection, rather than selecting all four strings in their entirety I lose all additional cursors, and only'.username'is selected.So, as far as I understand it, there remains here a bug in which expanding selection loses multi-cursor context, but perhaps I am misunderstanding or trying to execute this incorrectly.
Thanks for taking the time to review this.
jrieken commentedon Apr 3, 2019
Closing this as we have finalised the extension API for VS Code 1.33 (planned to ship this week). Remaining work is tracked here: https://github.com/Microsoft/vscode/labels/smart-select. Please file new issues for more feedback. Thanks & Happy Coding!