Comments (6)
I would use this for both. If this recorder tool existed, I could show you exactly what I did and in which way automatisation would have helped me! (and how much time I spent on doing it manually)
from js-assistant.
It is a ts server plugin and heavily uses type checking.
from js-assistant.
Resharper has an entire Wizard for this.
When you use "Introduce parameter", it will go through all callers an offers options to fix those.
Basically, these are the resolution options:
- For functions and methods: Use/Introduce parameter (and go to callers of this method when a new parameter has been added)
- For classes: Use/Introduce field (and go to callers of the constructor when a new constructor parameter is added)
- Use variable in scope
Ideally you could use breadth search on all symbols in scope to find valid expressions.
Also, if there are multiple possible expressions, pre-select the one that has the best levenshtein distance to parameter name (e.g. parameter name is input1: ITextModel
, in scope are this.input1TextModel: ITextModel
and this.input2TextModel: ITextModel
- then you should suggest this.input1TextModel
as first option).
I think this feature could be a wow-factor.
from js-assistant.
Wow, thanks for this awesome writeup! "Introduce parameter" is one of the refactorings I was thinking about :)
Just for me to understand your flow better (because the title says "Fix missing argument"), would you primarily need to
- just fix missing argument issues
- or run an "introduce parameter" refactoring on a function/method/constructor
- or both?
from js-assistant.
Another code example where it would have saved me some seconds:
This feature could find all three missing arguments from the context.
from js-assistant.
This is pretty cool!
P42 is currently limited to type information from a single file for performance reasons - I would need to extend the architecture to be able to get type information that's comparable to what the TS service offers. Do you know if there is a way to access the TS type information from other extensions?
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.