Skip to content

Commit 17eecbb

Browse files
authored
Merge pull request #30 from yeo-li/fix/no-editor-no-memo
[fix] 에디터가 없을 때, 메모가 생성되지 않는 문제 해결
2 parents b772509 + db42061 commit 17eecbb

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/main/kotlin/com/github/yeoli/devlog/domain/memo/service/MemoService.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,18 @@ class MemoService(private val project: Project) {
2727
val editor = getActiveEditor(project)
2828
if (editor == null) {
2929
logger.warn("[createMemo] editor가 null이므로 null을 반환합니다.")
30-
return null
30+
31+
return Memo(
32+
content = content,
33+
commitHash = null,
34+
filePath = null,
35+
selectedCodeSnippet = null,
36+
fullCodeSnapshot = null,
37+
selectionStart = null,
38+
selectionEnd = null,
39+
visibleStart = null,
40+
visibleEnd = null
41+
)
3142
}
3243

3344
val selectionModel = editor.selectionModel

src/test/kotlin/com/github/yeoli/devlog/domain/memo/service/MemoServiceTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class MemoServiceTest : BasePlatformTestCase() {
134134

135135
// expect
136136
val memo: Memo? = MemoService(project).createMemo("에디터 없음")
137-
assertNull(memo);
137+
assertNotNull(memo)
138138
}
139139

140140
fun `test 메모 생성 파일경로 없음`() {

0 commit comments

Comments
 (0)