@reactive-vscode/mock 0.4.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/class/Position.ts +12 -12
- package/src/ns/window.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactive-vscode/mock",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-beta.1",
|
|
5
5
|
"description": "Mock VSCode API for testing",
|
|
6
6
|
"author": "_Kerman <kermanx@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"src"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"vitest": "^
|
|
33
|
+
"vitest": "^4.0.16",
|
|
34
34
|
"vscode-uri": "^3.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/vscode": "^1.
|
|
37
|
+
"@types/vscode": "^1.107.0",
|
|
38
38
|
"typescript": "^5.9.3"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
package/src/class/Position.ts
CHANGED
|
@@ -39,13 +39,13 @@ export class Position implements vscode.Position {
|
|
|
39
39
|
translate(lineDeltaOrChange: number | { lineDelta?: number, characterDelta?: number } = 0, characterDelta = 0): Position {
|
|
40
40
|
return typeof lineDeltaOrChange === 'object'
|
|
41
41
|
? new Position(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
(lineDeltaOrChange.lineDelta ?? 0) + this.line,
|
|
43
|
+
(lineDeltaOrChange.characterDelta ?? 0) + this.character,
|
|
44
|
+
)
|
|
45
45
|
: new Position(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
lineDeltaOrChange + this.line,
|
|
47
|
+
characterDelta + this.character,
|
|
48
|
+
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
with(line?: number, character?: number): Position
|
|
@@ -53,12 +53,12 @@ export class Position implements vscode.Position {
|
|
|
53
53
|
with(lineOrChange?: number | { line?: number, character?: number }, character?: number): Position {
|
|
54
54
|
return typeof lineOrChange === 'object'
|
|
55
55
|
? new Position(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
lineOrChange.line ?? this.line,
|
|
57
|
+
lineOrChange.character ?? this.character,
|
|
58
|
+
)
|
|
59
59
|
: new Position(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
lineOrChange ?? this.line,
|
|
61
|
+
character ?? this.character,
|
|
62
|
+
)
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/ns/window.ts
CHANGED
|
@@ -47,7 +47,7 @@ export function createMockWindow(_context: MockVscode) {
|
|
|
47
47
|
|
|
48
48
|
async showTextDocument(document: vscode.TextDocument, column?: vscode.ViewColumn, preserveFocus?: boolean): Promise<vscode.TextEditor>
|
|
49
49
|
async showTextDocument(document: vscode.TextDocument, options?: vscode.TextDocumentShowOptions): Promise<vscode.TextEditor>
|
|
50
|
-
async showTextDocument(uri: vscode.Uri, options?: vscode.
|
|
50
|
+
async showTextDocument(uri: vscode.Uri, options?: vscode.TextDocumentShowOptions): Promise<vscode.TextEditor>
|
|
51
51
|
async showTextDocument(docOrUri: vscode.TextDocument | vscode.Uri, columnOrOptions?: vscode.ViewColumn | vscode.TextDocumentShowOptions, _preserveFocus?: boolean): Promise<vscode.TextEditor> {
|
|
52
52
|
const document = docOrUri instanceof TextDocument ? docOrUri : await _context.workspace.openTextDocument(docOrUri as vscode.Uri)
|
|
53
53
|
let editor = this._visibleTextEditors.value.find(editor => editor.document === document)
|