Skip to content

Commit dfdb807

Browse files
committed
Refactor comments for clarity and consistency in extension.ts
- Translated comments from Korean to English for better accessibility. - Improved comment clarity by refining descriptions of functionality and logic. - Ensured consistent formatting and terminology throughout the file for maintainability.
1 parent 035f492 commit dfdb807

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

vscode-rescriptdep/src/extension.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const FOCUS_MODULE_DEPENDENCIES = 'bibimbob.focusModuleDependencies';
1010

1111
// Track the current webview panel
1212
let currentPanel: vscode.WebviewPanel | undefined = undefined;
13-
// 전역 변수로 현재 DOT 콘텐츠와 모듈 상태 추적
13+
// Track current DOT content and module state as global variables
1414
let currentDotContent: string = '';
1515
let currentIsFocusedMode: boolean = false;
1616
let currentCenterModule: string | undefined = undefined;
@@ -514,7 +514,7 @@ async function runRescriptDep(cliPath: string, args: string[], context?: vscode.
514514

515515
// Function to display DOT format graph in webview
516516
function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: string, isFocusedMode: boolean = false, centerModuleName?: string) {
517-
// 전역 변수에 현재 상태 저장
517+
// Save current state to global variables
518518
currentDotContent = dotContent;
519519
currentIsFocusedMode = isFocusedMode;
520520
currentCenterModule = centerModuleName;
@@ -527,77 +527,77 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
527527
'bgcolor="transparent" fontcolor="#e0e0e0"' :
528528
'bgcolor="transparent" fontcolor="#333333"';
529529

530-
// 노드 배경색 및 패딩 설정 - 더 명확한 색상과 스타일 적용
530+
// Node background color and padding settings - apply clearer colors and styles
531531
const nodeStyle = isDarkTheme ?
532532
'node[shape=box, fontname="sans-serif", style="filled", fillcolor="#1e1e1e", margin="0.3,0.2", color="#aaaaaa", penwidth=1]' :
533533
'node[shape=box, fontname="sans-serif", style="filled", fillcolor="#f0f0f0", margin="0.3,0.2", color="#666666", penwidth=1]';
534534

535-
// 라인과 화살표 스타일 설정
535+
// Line and arrow style settings
536536
const edgeStyle = isDarkTheme ?
537537
'edge[color="#555555", arrowsize=0.8, arrowhead=normal, penwidth=1, minlen=1]' :
538538
'edge[color="#cccccc", arrowsize=0.8, arrowhead=normal, penwidth=1, minlen=1]';
539539

540-
// Update DOT content - node 스타일을 직접 적용
540+
// Update DOT content - apply node styles directly
541541
let themedDotContent = dotContent;
542542

543-
// 기본 속성 설정
543+
// Set basic properties
544544
themedDotContent = themedDotContent.replace(/^(digraph\s+\w+\s*\{)/m,
545545
`$1\n ${themeAttributes}\n ${nodeStyle}\n ${edgeStyle}\n splines=true\n overlap=false\n sep="+10"`);
546546

547-
// 노드 스타일을 강제로 적용 - 모든 노드에 직접 스타일 추가
547+
// Force apply node styles - add style directly to all nodes
548548
if (isDarkTheme) {
549-
// 다크 테마에서는 어두운 배경색 적용
549+
// Apply dark background in dark theme
550550
themedDotContent = themedDotContent.replace(/\s+(\w+)\s*\[/g, ' $1 [style="filled", fillcolor="#1e1e1e", ');
551551
} else {
552-
// 라이트 테마에서는 연한 회색 배경색 적용
552+
// Apply light gray background in light theme
553553
themedDotContent = themedDotContent.replace(/\s+(\w+)\s*\[/g, ' $1 [style="filled", fillcolor="#f0f0f0", ');
554554
}
555555

556-
// 포커스 모드일 때 중앙 모듈 스타일 추가
556+
// Add center module style in focus mode
557557
if (isFocusedMode && centerModuleName) {
558-
// 중앙 모듈의 노드 스타일 변경
558+
// Change the style of the center module node
559559
const centerNodePattern = new RegExp(`\\s+(${centerModuleName})\\s*\\[`);
560560
themedDotContent = themedDotContent.replace(centerNodePattern, ` $1 [style="filled", fillcolor="lightgreen", `);
561561

562-
// 보다 강력한 엣지 색상 변경 로직 - DOT 형식에 맞춰 수정
562+
// Enhanced edge color change logic - modified to match DOT format
563563
const lines = themedDotContent.split('\n');
564564
const coloredLines = lines.map(line => {
565-
// 더 정확한 엣지 라인 패턴 매칭
566-
if (line.includes('->') && !line.includes('//')) { // 주석이 아닌 엣지 라인
565+
// More accurate edge line pattern matching
566+
if (line.includes('->') && !line.includes('//')) { // Edge line that's not a comment
567567
const trimmed = line.trim();
568568

569-
// source -> target 패턴 찾기 (속성 있는 경우와 없는 경우 모두 처리)
569+
// Find source -> target pattern (handling cases with and without attributes)
570570
const parts = trimmed.split('->');
571571
if (parts.length === 2) {
572572
const source = parts[0].trim();
573573
let target = parts[1].trim();
574574

575-
// 세미콜론이나 속성 제거해서 순수 타겟 이름 추출
575+
// Extract pure target name by removing semicolons or attributes
576576
const targetName = target.split(/[\[\s;]/)[0].trim();
577577

578-
// 이미 속성이 있는지 확인
578+
// Check if attributes already exist
579579
const hasAttributes = target.includes('[');
580580

581-
// 1. dependents -> center (중앙 모듈로 들어오는 화살표)
581+
// 1. dependents -> center (arrows coming into the center module)
582582
if (targetName === centerModuleName) {
583583
if (hasAttributes) {
584-
// 기존 속성에 색상 추가 - 다크 테마일 때 더 어두운 색상 사용
584+
// Add color to existing attributes - use darker color in dark theme
585585
const arrowColor = isDarkTheme ? 'steelblue' : 'lightblue';
586586
return line.replace(/\[([^\]]*)\]/, `[color="${arrowColor}", penwidth=1.5, $1]`);
587587
} else {
588-
// 새 속성 추가 - 다크 테마일 때 더 어두운 색상 사용
588+
// Add new attributes - use darker color in dark theme
589589
const arrowColor = isDarkTheme ? 'steelblue' : 'lightblue';
590590
return line.replace(/;/, ` [color="${arrowColor}", penwidth=1.5];`);
591591
}
592592
}
593-
// 2. center -> dependencies (중앙 모듈에서 나가는 화살표)
593+
// 2. center -> dependencies (arrows going out from the center module)
594594
else if (source === centerModuleName) {
595595
if (hasAttributes) {
596-
// 기존 속성에 색상 추가 - 다크 테마일 때 더 어두운 색상 사용
596+
// Add color to existing attributes - use darker color in dark theme
597597
const arrowColor = isDarkTheme ? 'indianred' : 'lightcoral';
598598
return line.replace(/\[([^\]]*)\]/, `[color="${arrowColor}", penwidth=1.5, $1]`);
599599
} else {
600-
// 새 속성 추가 - 다크 테마일 때 더 어두운 색상 사용
600+
// Add new attributes - use darker color in dark theme
601601
const arrowColor = isDarkTheme ? 'indianred' : 'lightcoral';
602602
return line.replace(/;/, ` [color="${arrowColor}", penwidth=1.5];`);
603603
}
@@ -1503,7 +1503,7 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
15031503
// Detect if the current theme is dark
15041504
const isDarkTheme = vscode.window.activeColorTheme && vscode.window.activeColorTheme.kind === vscode.ColorThemeKind.Dark;
15051505

1506-
// 테마 스타일 설정
1506+
// Set theme style
15071507
const themeAttributes = isDarkTheme ?
15081508
'bgcolor="transparent" fontcolor="#e0e0e0"' :
15091509
'bgcolor="transparent" fontcolor="#333333"';
@@ -1516,64 +1516,64 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
15161516
'edge[color="#555555", arrowsize=0.8, arrowhead=normal, penwidth=1, minlen=1]' :
15171517
'edge[color="#cccccc", arrowsize=0.8, arrowhead=normal, penwidth=1, minlen=1]';
15181518

1519-
// Update DOT content - node 스타일을 직접 적용
1519+
// Update DOT content - apply node styles directly
15201520
let themedDotContent = dotContent;
15211521

1522-
// 기본 속성 설정
1522+
// Set basic properties
15231523
themedDotContent = themedDotContent.replace(/^(digraph\s+\w+\s*\{)/m,
15241524
`$1\n ${themeAttributes}\n ${nodeStyle}\n ${edgeStyle}\n splines=true\n overlap=false\n sep="+10"`);
15251525

1526-
// 노드 스타일을 강제로 적용
1526+
// Force apply node styles
15271527
if (isDarkTheme) {
15281528
themedDotContent = themedDotContent.replace(/\s+(\w+)\s*\[/g, ' $1 [style="filled", fillcolor="#1e1e1e", ');
15291529
} else {
15301530
themedDotContent = themedDotContent.replace(/\s+(\w+)\s*\[/g, ' $1 [style="filled", fillcolor="#f0f0f0", ');
15311531
}
15321532

1533-
// 포커스 모드에서 중앙 모듈 및 엣지 스타일 처리
1534-
// 중앙 모듈의 노드 스타일 변경
1533+
// Process center module and edge styles in focus mode
1534+
// Change center module node style
15351535
const centerNodePattern = new RegExp(`\\s+(${moduleName})\\s*\\[`);
15361536
themedDotContent = themedDotContent.replace(centerNodePattern, ` $1 [style="filled", fillcolor="lightgreen", `);
15371537

1538-
// 엣지 색상 변경
1538+
// Change edge colors
15391539
const lines = themedDotContent.split('\n');
15401540
const coloredLines = lines.map(line => {
1541-
// 엣지 라인 패턴 매칭
1541+
// Edge line pattern matching
15421542
if (line.includes('->') && !line.includes('//')) {
15431543
const trimmed = line.trim();
15441544

1545-
// source -> target 패턴 찾기
1545+
// Find source -> target pattern
15461546
const parts = trimmed.split('->');
15471547
if (parts.length === 2) {
15481548
const source = parts[0].trim();
15491549
let target = parts[1].trim();
15501550

1551-
// 순수 타겟 이름 추출
1551+
// Extract pure target name
15521552
const targetName = target.split(/[\[\s;]/)[0].trim();
15531553

1554-
// 속성 여부 확인
1554+
// Check if attributes exist
15551555
const hasAttributes = target.includes('[');
15561556

1557-
// 1. dependents -> center (중앙 모듈로 들어오는 화살표)
1557+
// 1. dependents -> center (arrows coming into the center module)
15581558
if (targetName === moduleName) {
15591559
if (hasAttributes) {
1560-
// 기존 속성에 색상 추가 - 다크 테마일 때 더 어두운 색상 사용
1560+
// Add color to existing attributes - use darker color in dark theme
15611561
const arrowColor = isDarkTheme ? 'steelblue' : 'lightblue';
15621562
return line.replace(/\[([^\]]*)\]/, `[color="${arrowColor}", penwidth=1.5, $1]`);
15631563
} else {
1564-
// 새 속성 추가 - 다크 테마일 때 더 어두운 색상 사용
1564+
// Add new attributes - use darker color in dark theme
15651565
const arrowColor = isDarkTheme ? 'steelblue' : 'lightblue';
15661566
return line.replace(/;/, ` [color="${arrowColor}", penwidth=1.5];`);
15671567
}
15681568
}
1569-
// 2. center -> dependencies (중앙 모듈에서 나가는 화살표)
1569+
// 2. center -> dependencies (arrows going out from the center module)
15701570
else if (source === moduleName) {
15711571
if (hasAttributes) {
1572-
// 기존 속성에 색상 추가 - 다크 테마일 때 더 어두운 색상 사용
1572+
// Add color to existing attributes - use darker color in dark theme
15731573
const arrowColor = isDarkTheme ? 'indianred' : 'lightcoral';
15741574
return line.replace(/\[([^\]]*)\]/, `[color="${arrowColor}", penwidth=1.5, $1]`);
15751575
} else {
1576-
// 새 속성 추가 - 다크 테마일 때 더 어두운 색상 사용
1576+
// Add new attributes - use darker color in dark theme
15771577
const arrowColor = isDarkTheme ? 'indianred' : 'lightcoral';
15781578
return line.replace(/;/, ` [color="${arrowColor}", penwidth=1.5];`);
15791579
}

0 commit comments

Comments
 (0)