Comments (10)
@OliverJAsh I've released v1.118.0
which allows you to choose what code assists are shown when there is an overlap:
I've chosen the opt-out solution, i.e. P42 deactivates overlapping TS code actions by default, to provide a good user experience out of the box for most users.
from js-assistant.
@OliverJAsh I've just released v1.115.1
. Starting with that version, you can assign keyboard shortcuts to the matching code actions from the JavaScript Assistant:
{
"key": "shift+alt+r",
"command": "editor.action.codeAction",
"args": { "kind": "refactor.convert.p42.remove-braces-from-arrow-function" }
},
{
"key": "shift+alt+a",
"command": "editor.action.codeAction",
"args": { "kind": "refactor.convert.p42.add-braces-to-arrow-function" }
},
Adding a setting to enable/disable the overlapping typescript refactorings and making this an opt-in experience (because it can affect the current setup) will come in a future release.
Thanks for reporting the issue!
from js-assistant.
There is some overlap between the refactorings that P42 offers and the refactorings that are built into TypeScript.
What UX would you ideally expect here?
from js-assistant.
You can implement a typescript language service plugin to disable the TypeScript refactoring.
I would expect to not suggest the same refactoring twice.
from js-assistant.
I agree, seeing the same refactoring twice is not great. I'm a bit hesitant to disable functionality provided by TS or to affect their language service from the P42 extension (which can cause stability issues, especially when they upgrade to different versions).
Maybe I'll implement it as a separate open source companion extension where you can selectively disable some TypeScript refactorings. Would this be an option for you?
from js-assistant.
I would ship it with the same extension. You can still add settings to disable it.
The default experience should be a good one, seeing the same refactoring twice is not good.
If you can't or don't want to disable the TypeScript "Add braces to arrow function", you could disable P42's refactoring "Add {...} to arrow function" instead.
from js-assistant.
I'll think about how to best do this, maybe there are other options as well. Disabling the P42 refactoring is safer, it might be a preferrable default option.
from js-assistant.
Fixed in v1.112.3
for add / remove braces to arrow functions. The refactoring from the typescript language service is now hidden, except on web (because typescript does not support plugins on web yet). Thanks for the bug report!
from js-assistant.
The refactoring from the typescript language service is now hidden
Is there a way to disable this? I have the following keyboard shortcuts setup to use these built-in refactorings and they no longer work:
{
"key": "shift+alt+r",
"command": "editor.action.codeAction",
"args": { "kind": "refactor.rewrite.arrow.braces.remove" }
},
{
"key": "shift+alt+a",
"command": "editor.action.codeAction",
"args": { "kind": "refactor.rewrite.arrow.braces.add" }
},
Alternatively, is it possible to update my keyboard shortcuts to use the refactorings provided by this extension?
from js-assistant.
@OliverJAsh thanks for the bug report! Right now, both options are unfortunately not possible. I'll look into adding a setting for disabling the ts code action hiding, and also expose each refactoring with a specific kind, so it can be mapped to a shortcut.
from js-assistant.
Related Issues (20)
- 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`
- Issue with "import.meta" syntax
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.