Skip to content

Commit 81d2e44

Browse files
committed
feat: enhance file statistics tracking and notifications
- Added functionality to gather and display file type statistics after file collection. - Introduced a new notification system to show the number of files copied and total lines. - Updated `package.json` to include Prettier for code formatting. - Updated various dependencies to their latest versions for improved stability and performance. - Refactored command handling to support new statistics feature. - Improved code readability by ensuring consistent formatting and style across multiple files.
1 parent fe07cc3 commit 81d2e44

24 files changed

+740
-683
lines changed

.vscode-test.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineConfig } from '@vscode/test-cli';
1+
import { defineConfig } from "@vscode/test-cli";
22

33
export default defineConfig({
4-
files: 'out/test/**/*.test.js',
4+
files: "out/test/**/*.test.js",
55
});

.vscode/extensions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
// See http://go.microsoft.com/fwlink/?LinkId=827846
33
// for the documentation about the extensions.json format
4-
"recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers", "ms-vscode.extension-test-runner"]
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"connor4312.esbuild-problem-matchers",
7+
"ms-vscode.extension-test-runner"
8+
]
59
}

.vscode/launch.json

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
{
6-
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Run Extension",
10-
"type": "extensionHost",
11-
"request": "launch",
12-
"args": [
13-
"--extensionDevelopmentPath=${workspaceFolder}"
14-
],
15-
"outFiles": [
16-
"${workspaceFolder}/dist/**/*.js"
17-
],
18-
"preLaunchTask": "${defaultBuildTask}"
19-
}
20-
]
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
13+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
14+
"preLaunchTask": "${defaultBuildTask}"
15+
}
16+
]
2117
}

.vscode/settings.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
3-
"files.exclude": {
4-
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5-
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6-
},
7-
"search.exclude": {
8-
"out": true, // set this to false to include "out" folder in search results
9-
"dist": true // set this to false to include "dist" folder in search results
10-
},
11-
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12-
"typescript.tsc.autoDetect": "off"
13-
}
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

.vscode/tasks.json

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,58 @@
11
// See https://go.microsoft.com/fwlink/?LinkId=733558
22
// for the documentation about the tasks.json format
33
{
4-
"version": "2.0.0",
5-
"tasks": [
6-
{
7-
"label": "watch",
8-
"dependsOn": [
9-
"npm: watch:tsc",
10-
"npm: watch:esbuild"
11-
],
12-
"presentation": {
13-
"reveal": "never"
14-
},
15-
"group": {
16-
"kind": "build",
17-
"isDefault": true
18-
}
19-
},
20-
{
21-
"type": "npm",
22-
"script": "watch:esbuild",
23-
"group": "build",
24-
"problemMatcher": "$esbuild-watch",
25-
"isBackground": true,
26-
"label": "npm: watch:esbuild",
27-
"presentation": {
28-
"group": "watch",
29-
"reveal": "never"
30-
}
31-
},
32-
{
33-
"type": "npm",
34-
"script": "watch:tsc",
35-
"group": "build",
36-
"problemMatcher": "$tsc-watch",
37-
"isBackground": true,
38-
"label": "npm: watch:tsc",
39-
"presentation": {
40-
"group": "watch",
41-
"reveal": "never"
42-
}
43-
},
44-
{
45-
"type": "npm",
46-
"script": "watch-tests",
47-
"problemMatcher": "$tsc-watch",
48-
"isBackground": true,
49-
"presentation": {
50-
"reveal": "never",
51-
"group": "watchers"
52-
},
53-
"group": "build"
54-
},
55-
{
56-
"label": "tasks: watch-tests",
57-
"dependsOn": [
58-
"npm: watch",
59-
"npm: watch-tests"
60-
],
61-
"problemMatcher": []
62-
}
63-
]
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "watch",
8+
"dependsOn": ["npm: watch:tsc", "npm: watch:esbuild"],
9+
"presentation": {
10+
"reveal": "never"
11+
},
12+
"group": {
13+
"kind": "build",
14+
"isDefault": true
15+
}
16+
},
17+
{
18+
"type": "npm",
19+
"script": "watch:esbuild",
20+
"group": "build",
21+
"problemMatcher": "$esbuild-watch",
22+
"isBackground": true,
23+
"label": "npm: watch:esbuild",
24+
"presentation": {
25+
"group": "watch",
26+
"reveal": "never"
27+
}
28+
},
29+
{
30+
"type": "npm",
31+
"script": "watch:tsc",
32+
"group": "build",
33+
"problemMatcher": "$tsc-watch",
34+
"isBackground": true,
35+
"label": "npm: watch:tsc",
36+
"presentation": {
37+
"group": "watch",
38+
"reveal": "never"
39+
}
40+
},
41+
{
42+
"type": "npm",
43+
"script": "watch-tests",
44+
"problemMatcher": "$tsc-watch",
45+
"isBackground": true,
46+
"presentation": {
47+
"reveal": "never",
48+
"group": "watchers"
49+
},
50+
"group": "build"
51+
},
52+
{
53+
"label": "tasks: watch-tests",
54+
"dependsOn": ["npm: watch", "npm: watch-tests"],
55+
"problemMatcher": []
56+
}
57+
]
6458
}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- **Smart Import Following**: Automatically collects files based on import statements
88
- **Multi-Language**: TypeScript, JavaScript, Java, Kotlin, Python
9-
- **Two Modes**:
9+
- **Two Modes**:
1010
- Import-based collection (follows dependencies)
1111
- Collect entire workspace (with filtering)
1212
- **AI-Ready Output**: Formatted with file paths and line numbers
@@ -18,11 +18,12 @@
1818
- **Context Menu**: Right-click files/folders → "Code Collect"
1919

2020
## Output Format
21+
2122
```plaintext
2223
// src/utils/helper.ts (L1-L25)
2324
[your code here]
2425
// src/main.ts (L26-L50)
2526
[your code here]
2627
```
2728

28-
Perfect for sharing code context with ChatGPT, Claude, and other AI assistants.
29+
Perfect for sharing code context with ChatGPT, Claude, and other AI assistants.

esbuild.js

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
const esbuild = require("esbuild");
22

3-
const production = process.argv.includes('--production');
4-
const watch = process.argv.includes('--watch');
3+
const production = process.argv.includes("--production");
4+
const watch = process.argv.includes("--watch");
55

66
/**
77
* @type {import('esbuild').Plugin}
88
*/
99
const esbuildProblemMatcherPlugin = {
10-
name: 'esbuild-problem-matcher',
10+
name: "esbuild-problem-matcher",
1111

12-
setup(build) {
13-
build.onStart(() => {
14-
console.log('[watch] build started');
15-
});
16-
build.onEnd((result) => {
17-
result.errors.forEach(({ text, location }) => {
18-
console.error(`✘ [ERROR] ${text}`);
19-
console.error(` ${location.file}:${location.line}:${location.column}:`);
20-
});
21-
console.log('[watch] build finished');
22-
});
23-
},
12+
setup(build) {
13+
build.onStart(() => {
14+
console.log("[watch] build started");
15+
});
16+
build.onEnd((result) => {
17+
result.errors.forEach(({ text, location }) => {
18+
console.error(`✘ [ERROR] ${text}`);
19+
console.error(
20+
` ${location.file}:${location.line}:${location.column}:`,
21+
);
22+
});
23+
console.log("[watch] build finished");
24+
});
25+
},
2426
};
2527

2628
async function main() {
27-
const ctx = await esbuild.context({
28-
entryPoints: [
29-
'src/extension.ts'
30-
],
31-
bundle: true,
32-
format: 'cjs',
33-
minify: production,
34-
sourcemap: !production,
35-
sourcesContent: false,
36-
platform: 'node',
37-
outfile: 'dist/extension.js',
38-
external: ['vscode'],
39-
logLevel: 'silent',
40-
plugins: [
41-
/* add to the end of plugins array */
42-
esbuildProblemMatcherPlugin,
43-
],
44-
});
45-
if (watch) {
46-
await ctx.watch();
47-
} else {
48-
await ctx.rebuild();
49-
await ctx.dispose();
50-
}
29+
const ctx = await esbuild.context({
30+
entryPoints: ["src/extension.ts"],
31+
bundle: true,
32+
format: "cjs",
33+
minify: production,
34+
sourcemap: !production,
35+
sourcesContent: false,
36+
platform: "node",
37+
outfile: "dist/extension.js",
38+
external: ["vscode"],
39+
logLevel: "silent",
40+
plugins: [
41+
/* add to the end of plugins array */
42+
esbuildProblemMatcherPlugin,
43+
],
44+
});
45+
if (watch) {
46+
await ctx.watch();
47+
} else {
48+
await ctx.rebuild();
49+
await ctx.dispose();
50+
}
5151
}
5252

53-
main().catch(e => {
54-
console.error(e);
55-
process.exit(1);
53+
main().catch((e) => {
54+
console.error(e);
55+
process.exit(1);
5656
});

eslint.config.mjs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
import typescriptEslint from "@typescript-eslint/eslint-plugin";
22
import tsParser from "@typescript-eslint/parser";
33

4-
export default [{
4+
export default [
5+
{
56
files: ["**/*.ts"],
6-
}, {
7+
},
8+
{
79
plugins: {
8-
"@typescript-eslint": typescriptEslint,
10+
"@typescript-eslint": typescriptEslint,
911
},
1012

1113
languageOptions: {
12-
parser: tsParser,
13-
ecmaVersion: 2022,
14-
sourceType: "module",
14+
parser: tsParser,
15+
ecmaVersion: 2022,
16+
sourceType: "module",
1517
},
1618

1719
rules: {
18-
"@typescript-eslint/naming-convention": ["warn", {
19-
selector: "import",
20-
format: ["camelCase", "PascalCase"],
21-
}],
20+
"@typescript-eslint/naming-convention": [
21+
"warn",
22+
{
23+
selector: "import",
24+
format: ["camelCase", "PascalCase"],
25+
},
26+
],
2227

23-
curly: "warn",
24-
eqeqeq: "warn",
25-
"no-throw-literal": "warn",
26-
semi: "warn",
28+
curly: "warn",
29+
eqeqeq: "warn",
30+
"no-throw-literal": "warn",
31+
semi: "warn",
2732
},
28-
}];
33+
},
34+
];

0 commit comments

Comments
 (0)