11import * as vscode from 'vscode' ;
22import { mkdir , writeFile } from 'node:fs/promises' ;
3- import { join } from 'node:path' ;
3+ import { join , basename } from 'node:path' ;
44
55export async function activate ( context : vscode . ExtensionContext ) {
6+ const config = vscode . workspace . getConfiguration ( 'newPackage' ) ;
7+ const fileNameSetting = config . get < string > ( 'fileName' , 'index.ts' ) ;
8+ const fileContentTemplate = config . get < string > ( 'fileContent' , '' ) ;
9+
10+ const provider = vscode . window . registerFileDecorationProvider ( {
11+ provideFileDecoration ( uri ) {
12+ if ( basename ( uri . fsPath ) === fileNameSetting ) {
13+ return {
14+ badge : "_" , // du kannst hier auch "★" oder "·" verwenden
15+ tooltip : "Entrypoint (index.ts)" ,
16+ color : new vscode . ThemeColor ( "charts.blue" ) ,
17+ } ;
18+ }
19+ return undefined ;
20+ }
21+ } ) ;
22+
623 const disposable = vscode . commands . registerCommand ( 'extension.newPackage' , async ( uri : vscode . Uri ) => {
724 let targetDir : string ;
825 if ( uri && uri . fsPath ) {
@@ -23,9 +40,7 @@ export async function activate(context: vscode.ExtensionContext) {
2340 return ;
2441 }
2542
26- const config = vscode . workspace . getConfiguration ( 'newPackage' ) ;
27- const fileNameSetting = config . get < string > ( 'fileName' , 'index.ts' ) ;
28- const fileContentTemplate = config . get < string > ( 'fileContent' , '' ) ;
43+
2944
3045 const packagePath = join ( targetDir , folderName ) ;
3146
@@ -53,6 +68,7 @@ export async function activate(context: vscode.ExtensionContext) {
5368 await vscode . window . showTextDocument ( doc ) ;
5469 } ) ;
5570
71+ context . subscriptions . push ( provider ) ;
5672 context . subscriptions . push ( disposable ) ;
5773}
5874
0 commit comments