20250207_first_run_with_auto_generated_code - chaehwanli/plantuml-parser GitHub Wiki

extension.ts μ‹€ν–‰ν•˜κΈ°

1. activate 에 λ“±λ‘λœ command 확인

Visual Studio Code μ—μ„œ extension 이 ν¬ν•¨λœ folder λ₯Ό open ν•œ 후에 sample 둜 μƒμ„±λœ helloworld command λ₯Ό μ‹€ν–‰ν•΄λ³΄μž. vscode.commands.registerCommand('xxx') 에 λ“±λ‘λœ 'xxx' λ₯Ό μ°Ύμ„μˆ˜ μžˆλ‹€. μ•„λž˜ 예제의 κ²½μš°μ—λŠ” "plantuml-parser-extension.helloWorld" 이고, command λ‘œλŠ” "helloworld" 이닀.

export function activate(context: vscode.ExtensionContext) {

	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('Congratulations, your extension "plantuml-parser-extension" is now active!');

	// The command has been defined in the package.json file
	// Now provide the implementation of the command with registerCommand
	// The commandId parameter must match the command field in package.json
	const disposable = vscode.commands.registerCommand('plantuml-parser-extension.helloWorld', () => {
		// The code you place here will be executed every time your command is executed
		// Display a message box to the user
		vscode.window.showInformationMessage('Hello World from plantuml-parser-extension!');
	});

	context.subscriptions.push(disposable);
}

2. F5 μ‹€ν–‰ (Start Debugging)

image Explorer μ—μ„œ extension.ts 에 focusλ₯Ό 두고 "Start Debugging F5" λ₯Ό μ‹€ν–‰ν•˜λ©΄ μ•„λž˜μ™€ 같이 "Extension Development Host" λΌλŠ” λ³„λ„μ˜ Visual Studio Code κ°€ ν•˜λ‚˜ λ”λœ¬λ‹€. image

3. "helloworld" command μ‹€ν–‰ν•˜κΈ°

"Extension Development Host" λΌλŠ” λ³„λ„μ˜ Visual Studio Code μ—μ„œ "Command Palette" λ₯Ό μ‹€ν–‰ν•˜κ³  "helloworld"λ₯Ό μž…λ ₯ν•˜λ©΄ μ•„λž˜μ™€ 같이 λͺ…령이 보이고 선택 κ°€λŠ₯ν•˜λ‹€. image