Bug report: Comment node is removed after "Extract to function in module scope
See original GitHub issueDoes this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.68.1
- OS Version: Ubuntu 22.04
NOTE: I couldn’t find this option in VSCode Insiders! (Maybe it is removed)
Hi. When I refactor a callback in my JSX, which does something rather complicated, one of my comments are removed.
Code example:
//@ts-nocheck
/* eslint-disable */
export default function Something() {
return (
<SomeComponent
aCallbackThatProducesAReactNode={() => {
// this comment will be kept intact
const someProps = {
prop1: props.props1, // BUT THIS COMMENT WILL BE REMOVED :(
prop2: props.props2 // this comment will be kept intact too
};
return <SomeOtherComponent {...someProps} />;
}}
/>
);
}
Try refactoring the whole callback into a function in module scope.
One:
Two:
Three:
As you see one of my comments are removed.
Thanks.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
npm install fails as node-gyp is unable to build lmdb #8152
bug report When trying to install parcel into npm project, npm install --save-dev parcel fails with exit code 7, complaining about node-gyp ...
Read more >Ask Question - Stack Overflow
This problem can be occur when you are trying to work with an old react repository which is developed with a lower node.js...
Read more >How to fix "The following module is missing from the file ...
Possible solutions: Restore the module and actually disable and uninstall it (recommended if possible): First, restore the module to its original location in ......
Read more >How To Work with Files using the fs Module in Node.js
In this article, you will use the fs module to read a file created via the command line, create and write to a...
Read more >Refactoring source code in Visual Studio Code
When working with classes, you can also extract a value to a new property. ... This keybinding, for example, triggers the Extract function...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aghArdeshir Because code actions (e.g., “extract function” or “extract constant”) are TypeScript language services which reside in this repository and any invocation at the VS Code side ends up here.
Thank you very much Babak jan 👍