Comments (3)
I agree - the perfect activation ranges are still an open question to me. There is a tradeoff between the activation ranges not being available where you'd want/expect them, and refactorings showing up when they are clearly not intended at that position.
Currently the default is the full AST match, but that quickly gets tricky in particular for nested functions. However, for e.g. the "move intialization" refactoring, when there are constants on the right hand side (e.g. "some value"
), then activating on them might be nice, but it could lead to UX inconsistencies which can be confusing.
I think it'll come down to a lot of experimentation and refinement before I can generalize, but maybe there is some general good way to do this that I just don't see yet.
For this particular case here, I ended up changing the activation range to the left hand side, the = and the first 3 characters of the right hand side, so it's readily availalbe but not showing in unwanted places.
v1.111.2
with the change should be available soon :) Thanks again
from js-assistant.
Thanks for reporting! I'll probably keep the activation on the left side of the expression as well (=
might be too small), so you could activate the refactoring on public readonly aField =
, but not on the right hand side. Would that work for you?
from js-assistant.
Yep, left side and =
is also good!
Generally, you probably just shouldn't report refactorings for the parent in arbitrary nested expressions or statements.
from js-assistant.
Related Issues (20)
- 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`
- Dependency Visualization - is it activated?
- webstorm support?
- "Toggle braces" not available if function returns `null`
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.