Skip to content

Commit 080e14c

Browse files
committed
fix: Restructure vscode mock to define CodeActionKind before use
1 parent d0146ae commit 080e14c

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/__mocks__/vscode.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Define CodeActionKind first
2+
class CodeActionKind {
3+
constructor(value) {
4+
this.value = value
5+
}
6+
7+
append(value) {
8+
return new CodeActionKind(`${this.value}.${value}`)
9+
}
10+
}
11+
12+
// Add static properties
13+
CodeActionKind.QuickFix = new CodeActionKind("quickfix")
14+
CodeActionKind.RefactorRewrite = new CodeActionKind("refactor.rewrite")
15+
116
const vscode = {
217
window: {
318
showInformationMessage: jest.fn(),
@@ -81,6 +96,7 @@ const vscode = {
8196
this.isPreferred = false
8297
}
8398
},
99+
CodeActionKind,
84100
FileType: {
85101
Unknown: 0,
86102
File: 1,
@@ -94,21 +110,4 @@ const vscode = {
94110
},
95111
}
96112

97-
// Define CodeActionKind after vscode object is created
98-
class CodeActionKind {
99-
constructor(value) {
100-
this.value = value
101-
}
102-
103-
append(value) {
104-
return new CodeActionKind(`${this.value}.${value}`)
105-
}
106-
}
107-
108-
// Add static properties after class definition
109-
CodeActionKind.QuickFix = new CodeActionKind("quickfix")
110-
CodeActionKind.RefactorRewrite = new CodeActionKind("refactor.rewrite")
111-
112-
vscode.CodeActionKind = CodeActionKind
113-
114113
module.exports = vscode

0 commit comments

Comments
 (0)