Comments (6)
I've added a "Select expression occurrences" code action in v1.117.0
. When you select an expression (selection boundaries must match expression), you can invoke the P42 action menu and start a multi-cursor selection on all occurrences:
This is different from the VS Code standard multi-cursor, because it checks that the expression occurrences use the same variables, this
context, etc.
from js-assistant.
Thanks for the suggestion! I'll think about how to best resolve this with a single refactoring.
It's already possible to achieve the renaming with a refactoring combo:
- extract
l
- change it's value
- inline
l
from js-assistant.
I thought more about this and evaluated various ways of achieving this. It turns out you can easily achieve this by using multiple cursors:
- select "l"
- start multiple cursors with โงโL
- change to
this
- end multiple cursors with Esc
Since there is a pretty elegant built-in solution, I'm wondering how P42 could improve on this.
from js-assistant.
This only works if l
is not part of some other word.
from js-assistant.
Ah, right. One idea I have is a replace expression
code assist where you could select an expression, invoke the action, and then all it's occurrences would be replaced with a text that you'd enter in a text box. Would that be closer to what you imagine?
from js-assistant.
That would be cool!
from js-assistant.
Related Issues (20)
- Please return the "Move up/down" commands HOT 6
- Issue with convert-if-else-to-conditional-expression HOT 1
- Wrong code generated by "Convert if-else into conditional expression" using p42 VSCode plugin v1.163.1 HOT 1
- Cannot pass the payment process on the select country window HOT 3
- Remove unused imports/class methods/variables HOT 2
- Unsafe suggestions HOT 2
- Support for Svelte components HOT 1
- Insert console.log for variable HOT 2
- Command Palette integration HOT 2
- Convert to destructuring assignment
- Create new file when extract React component
- convert-function-to-object-method potentially unsafe
- p42.ai is down HOT 2
- Refactor Idea: extract functions inside functions
- is the site https://p42.ai/ down? HOT 1
- Make P42 settings apply to remote and workspace, honour jsconfig/tsconfig settings
- provide setting to set default suggestion level
- provide setting to disable the codeActionsOnSave HOT 2
- TypeScript's built-in "inline variable" refactoring should be declared as an overlapping code assist HOT 1
- Feature Request: transform object property assignment to `defineProperty`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-assistant.