Comments (5)
Awesome, thanks for sharing the refactoring idea! This is somewhat similar to extract so it should be doable. How would you imagine the interaction, i.e. where would you want to trigger the refactoring?
from js-assistant.
Just realized that this is already possible with a refactoring combo:
- Extract variable with
flip(sourceNumber)
into e.g.targetNumber2
- Inline variable
targetNumber
- Rename
targetNumber2
totargetNumber
from js-assistant.
v1.112.0
now has a "replace with existing variable" refactoring that can be invoked on an expression. If there is a variable with the same expression, the expression will be replaced with the variable.
@hediet you said this would be a "second step after extracting a constant", which indicates to me that extract constant did not work as expected. The P42 extract constant should already extract all occurrences. Was there a specific case where the refactoring did not find all occurrences as expected?
from js-assistant.
The P42 extract constant should already extract all occurrences.
Oh, I was not aware of this. I used the typescript one, as it was suggested first I think.
I really recommend hiding the obsolete typescript refactorings by default (and adding a setting to show them again)!
from js-assistant.
I really recommend hiding the obsolete typescript refactorings by default (and adding a setting to show them again)!
I agree, you convinced me this is the best way to proceed.
The typescript extract const
refactoring is not fully replaced by the JavaScript Assistant yet, I need to add an option to extract a single occurrence and to determine the target scope.
from js-assistant.
Related Issues (20)
- 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`
- Dependency Visualization - is it activated?
- webstorm support?
- "Toggle braces" not available if function returns `null`
- Issue with "import.meta" syntax
- Lots of language server crashing since a few days ago, stopped when I disabled this extension
- Is this project still maintained? HOT 2
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.