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)
Explorer μμ extension.ts μ focusλ₯Ό λκ³ "Start Debugging F5" λ₯Ό μ€ννλ©΄
μλμ κ°μ΄ "Extension Development Host" λΌλ λ³λμ Visual Studio Code κ° νλ λλ¬λ€.
3. "helloworld" command μ€ννκΈ°
"Extension Development Host" λΌλ λ³λμ Visual Studio Code μμ "Command Palette" λ₯Ό μ€ννκ³ "helloworld"λ₯Ό μ
λ ₯νλ©΄ μλμ κ°μ΄ λͺ
λ Ήμ΄ λ³΄μ΄κ³ μ ν κ°λ₯νλ€.