stringham / copy-with-imports Goto Github PK
View Code? Open in Web Editor NEWVS Code extension to copy with imports
VS Code extension to copy with imports
e.g.
I suspect getRelativePath only converts the slash in one place:
https://github.com/stringham/copy-with-imports/blob/master/src/pathresolver.ts#L55
I would suggest either always replacing all back slashes or even using if (path.seperator is backslash then replace).
Are you still looking at this project, would you accept a PR?
Full reduced test case: https://github.com/OliverJAsh/copy-with-imports-base-url-test
Enable "copy-with-imports.path-relative-from-tsconfig": true
.
tsconfig.json
:
{
"compilerOptions": {
"baseUrl": "app"
}
}
app/helpers/foo.ts
:
export const foo = 1;
app/helpers/bar.ts
:
import { foo } from "./foo";
// 1. copy this
console.log(foo)
app/helpers/baz.ts
:
// 2. paste here
app/helpers/baz.ts
:
import {foo} from 'app/helpers/foo';
// 2. paste here
console.log(foo)
app/helpers/baz.ts
:
import {foo} from 'helpers/foo';
// 2. paste here
console.log(foo)
I think we need to account for config.compilerOptions.baseUrl
here:
copy-with-imports/src/pathresolver.ts
Line 46 in 521f6f2
When copying code, it takes a while to be copied which is annoying, specially if you don't have a feedback that it's copied and then you keep switching files and paste an old paste.
disabling the extension, copying code is instant
Since installing the extension, it made copying and pasting more efforts and extra overload.
Please help. If slowing down is a must but at least provide a notification that the copy is ready.
Also, please limit the extension to work only in typescript, javascript, etc.. those that can come with imports but definitely not HTML.
Plugin doesnt work with latest version of VSCODE.
let's say you do undo (cmd+z) a couple of times, then copy something(cmd+c), and then redo (cmd+shift+z) a couple of times. Without this extension you can do this. Unfortunately, with this extension enabled, after you copy(cmd+c), redo does not work. You lose your redo history.
Thanks! Love this extension!
Performance
copy-with-imports
0.1.7
Windows_NT x64 10.0.18363
1.53.2
stringham.copy-with-imports-unresponsive.cpuprofile.txt
`
Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load
Hi,
I really appreciate your work ๐ I'd like to know if it is possible to join imports from same package.
example:
in the example I'd like to have:
import React, {useContext} from 'react';
instead of:
import React from 'react';
import {useContext} from 'react';
Thank you!
Currently when copying code that uses
import type { IConfig } from './config';
You loose the type
-part of the import statement.
Awesome extension, I use it with my work, everyday but there is a small bug where I show below
When I copy lets say this function below in a .tsx
file :
export default function Hello(){
return <div>Hello World</div>
}
And then I paste it in another .tsx
file, it adds curly braces to the import statement, like below :
import { Hello } from './components/hello';
export default function App(){
return <Hello />
}
It shouldn't add curly braces when the function copied is an export default.
Is there a setting to fix this? or is this a known issue?
Any insight would be very helpful!
Every time I copy & paste some code. The first time it worked. But never again. One of the 'Code Helper' consumes over 99% of CPU. I had to kill it manually to keep VSCode running. leading to VSCode Extension Host terminated unexpectedly.
Disable this extension solves the problem. But I really love the convenience this extension has been providing. Could you please take a look at this problem?
OS: Mac OSX 10.13.4 High Sierra
VSCode: 1.22.2
Is it possible to support .js
files with allowJs
?
I imagine the changes would include:
.js
and .jsx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.