Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# made by bootra

"comment" = { fg = "berry_desaturated" }
"constant" = { fg = "gold" }
"function" = { fg = "mint" }
"function.macro" = { fg = "bubblegum" }
"keyword" = { fg = "bubblegum" }
"operator" = { fg = "bubblegum" }
"punctuation" = { fg = "lilac" }
"string" = { fg = "gold" }
"type" = { fg = "violet" }
"variable" = { fg = "lilac" }
"variable.builtin" = { fg = "violet" }
"tag" = { fg = "gold" }
"label" = { fg = "gold" }
"attribute" = { fg = "lilac" }
"namespace" = { fg = "lilac" }
"module" = { fg = "lilac" }

"markup.heading" = { fg = "gold", modifiers = ["bold"] }
"markup.heading.marker" = { fg = "berry_desaturated" }
"markup.list" = { fg = "bubblegum" }
"markup.bold" = { modifiers = ["bold"] }
"markup.italic" = { modifiers = ["italic"] }
"markup.strikethrough" = { modifiers = ["crossed_out"] }
"markup.link.url" = { fg = "violet", modifiers = ["underlined"] }
"markup.link.text" = { fg = "violet" }
"markup.quote" = { fg = "berry_desaturated" }
"markup.raw" = { fg = "mint" }

"ui.background" = { bg = "berry" }
"ui.cursor" =  { fg = "berry", bg = "lilac" }
"ui.cursor.match" = { fg = "berry", bg = "berry_desaturated" }
"ui.cursor.select" = { fg = "berry", bg = "violet" }
"ui.cursor.insert" = { fg = "berry", bg = "mint" }
"ui.linenr" = { fg = "berry_desaturated" }
"ui.linenr.selected" = { fg = "lilac" }
"ui.cursorline" = { fg = "lilac", bg = "berry_dim" }
"ui.statusline" = { fg = "lilac", bg = "berry_saturated" }
"ui.statusline.inactive" = { fg = "berry_desaturated", bg = "berry_saturated" }
"ui.statusline.normal" = { fg = "berry_saturated", bg = "lilac" }
"ui.statusline.insert" = { fg = "berry_saturated", bg = "mint" }
"ui.statusline.select" = { fg = "berry_saturated", bg = "violet" }
"ui.popup" = { fg = "lilac", bg = "berry_saturated" }
"ui.window" = { fg = "berry_desaturated", bg = "berry" }
"ui.help" = { fg = "lilac", bg = "berry_saturated" }
"ui.text" = { fg = "lilac" }
"ui.text.focus" = { fg = "mint" }
"ui.menu" = { fg = "lilac", bg = "berry_saturated" }
"ui.menu.selected" = { fg = "mint", bg = "berry_saturated" }
"ui.selection" = { bg = "berry_saturated" }
"ui.virtual.whitespace" = { fg = "berry_desaturated" }
"ui.virtual.ruler" = { bg = "berry_dim" }
"ui.virtual.indent-guide" = { fg = "berry_fade" }
"ui.virtual.inlay-hint" = { fg = "berry_desaturated" }

"diff.plus" = { fg = "mint" }
"diff.delta" = { fg = "gold" }
"diff.minus" = { fg = "bubblegum" }

"error" = { fg = "bubblegum" }
"warning" = { fg = "gold" }
"info" = { fg = "lilac" }
"hint" = { fg = "lilac" }

"diagnostic.warning" = { underline = { color = "bubblegum", style = "curl"} }
"diagnostic.error" = { underline = { color = "gold", style = "curl"} }
"diagnostic.info" = { underline = { color = "lilac", style = "curl"} }
"diagnostic.hint" = { underline = { color = "lilac", style = "curl"} }

[palette]
berry = "#3A2A4D"
berry_fade = "#5A3D6E"
berry_dim = "#47345E"
berry_saturated = "#2B1C3D"
berry_desaturated = "#886C9C"
bubblegum = "#D678B5"
gold = "#E3C0A8"
lilac = "#C7B8E0"
mint = "#7FC9AB"
violet = "#C78DFC"
}); const include = request.include?.map((x) => x.id); const exclude = request.exclude?.map((x) => x.id); await client.sendRequest(ra.runTest, { include, exclude }); }, true, undefined, false, ); testController.createRunProfile( "Debug Tests", vscode.TestRunProfileKind.Debug, async (request: vscode.TestRunRequest) => { if (request.include?.length !== 1 || request.exclude?.length !== 0) { await vscode.window.showErrorMessage("You can debug only one test at a time"); return; } const id = request.include[0]!.id; const runnable = idToRunnableMap.get(id); if (!runnable) { await vscode.window.showErrorMessage("You can debug only one test at a time"); return; } await startDebugSession(ctx, runnable); }, true, undefined, false, ); const deleteTest = (item: vscode.TestItem, parentList: vscode.TestItemCollection) => { parentList.delete(item.id); idToTestMap.delete(item.id); idToRunnableMap.delete(item.id); if (item.uri) { fileToTestMap.set( item.uri.toString(), fileToTestMap.get(item.uri.toString())!.filter((t) => t.id !== item.id), ); } }; const addTest = (item: ra.TestItem) => { const parentList = item.parent ? idToTestMap.get(item.parent)!.children : testController.items; const oldTest = parentList.get(item.id); const uri = item.textDocument?.uri ? vscode.Uri.parse(item.textDocument?.uri) : undefined; const range = item.range && new vscode.Range( new vscode.Position(item.range.start.line, item.range.start.character), new vscode.Position(item.range.end.line, item.range.end.character), ); if (oldTest) { if (oldTest.uri?.toString() === uri?.toString()) { oldTest.range = range; return; } deleteTest(oldTest, parentList); } const iconToVscodeMap = { package: "package", module: "symbol-module", test: "beaker", }; const test = testController.createTestItem( item.id, `$(${iconToVscodeMap[item.kind]}) ${item.label}`, uri, ); test.range = range; test.canResolveChildren = item.canResolveChildren; idToTestMap.set(item.id, test); if (uri) { if (!fileToTestMap.has(uri.toString())) { fileToTestMap.set(uri.toString(), []); } fileToTestMap.get(uri.toString())!.push(test); } if (item.runnable) { idToRunnableMap.set(item.id, item.runnable); } parentList.add(test); }; const addTestGroup = (testsAndScope: ra.DiscoverTestResults) => { const { tests, scope, scopeFile } = testsAndScope; const testSet: Set<string> = new Set(); for (const test of tests) { addTest(test); testSet.add(test.id); } // FIXME(hack_recover_crate_name): We eagerly resolve every test if we got a lazy top level response (detected // by checking that `scope` is empty). This is not a good thing and wastes cpu and memory unnecessarily, so we // should remove it. if (!scope && !scopeFile) { for (const test of tests) { void testController.resolveHandler!(idToTestMap.get(test.id)); } } if (scope) { const recursivelyRemove = (tests: vscode.TestItemCollection) => { for (const [_, test] of tests) { if (!testSet.has(test.id)) { deleteTest(test, tests); } else { recursivelyRemove(test.children); } } }; for (const root of scope) { recursivelyRemove(idToTestMap.get(root)!.children); } } if (scopeFile) { const removeByFile = (file: vscode.Uri) => { const testsToBeRemoved = (fileToTestMap.get(file.toString()) || []).filter( (t) => !testSet.has(t.id), ); for (const test of testsToBeRemoved) { const parentList = test.parent?.children || testController.items; deleteTest(test, parentList); } }; for (const file of scopeFile) { removeByFile(vscode.Uri.parse(file.uri)); } } }; ctx.pushClientCleanup( client.onNotification(ra.discoveredTests, (results) => { addTestGroup(results); }), ); ctx.pushClientCleanup( client.onNotification(ra.endRunTest, () => { currentTestRun!.end(); currentTestRun = undefined; }), ); ctx.pushClientCleanup( client.onNotification(ra.appendOutputToRunTest, (output) => { currentTestRun!.appendOutput(`${output}\r\n`); }), ); ctx.pushClientCleanup( client.onNotification(ra.changeTestState, (results) => { const test = idToTestMap.get(results.testId)!; if (results.state.tag === "failed") { currentTestRun!.failed(test, new vscode.TestMessage(results.state.message)); } else if (results.state.tag === "passed") { currentTestRun!.passed(test); } else if (results.state.tag === "started") { currentTestRun!.started(test); } else if (results.state.tag === "skipped") { currentTestRun!.skipped(test); } else if (results.state.tag === "enqueued") { currentTestRun!.enqueued(test); } }), ); testController.resolveHandler = async (item) => { const results = await client.sendRequest(ra.discoverTest, { testId: item?.id }); addTestGroup(results); }; testController.refreshHandler = async () => { testController.items.forEach((t) => { testController.items.delete(t.id); }); idToTestMap = new Map(); await testController.resolveHandler!(undefined); }; };