mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
Folded block comments, Javadoc, line documentation and docstrings now show their opener, the first summary line, an ellipsis and the closer (/** Summary ...*/), as in IDEA. Backend folds of a comment now start at the comment itself, and the syntax-fold placeholder adapts when CodeMirror leaves /* and */ outside the range. Co-authored-by: ffgenius <106022674+ffgenius@users.noreply.github.com>
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import { expect, openFromTree, test } from "./fixtures";
|
|
|
|
for (const { name, source, expected } of [
|
|
{
|
|
name: "multiline documentation comment",
|
|
source: "/**\n * Creates a visitor record.\n * More detail.\n */\nexport const visitor = 1;",
|
|
expected: "/** Creates a visitor record. ...*/",
|
|
},
|
|
{
|
|
name: "inline documentation header",
|
|
source: "/** Returns the visitor name.\n * More detail.\n */\nexport const visitor = 1;",
|
|
expected: "/**...*/",
|
|
},
|
|
{
|
|
name: "ordinary block comment",
|
|
source:
|
|
"/*\n * Ordinary block comment for comparison.\n * It is not a documentation comment.\n */\nexport const visitor = 1;",
|
|
expected: "/* Ordinary block comment for comparison. ...*/",
|
|
},
|
|
]) {
|
|
test(`folds a JavaScript ${name} like IDEA`, async ({ workbench: page }, testInfo) => {
|
|
const editor = await openFromTree(page, "App.tsx");
|
|
const content = editor.locator(".cm-content");
|
|
await content.click();
|
|
await page.keyboard.press("Meta+a");
|
|
await page.keyboard.insertText(source);
|
|
await expect(editor.locator(".cm-line").first()).toHaveText(source.split("\n")[0]!);
|
|
|
|
await editor.locator(".cm-foldGutter .cm-openidea-foldOpen").first().click();
|
|
await expect(editor.locator(".cm-line").first()).toHaveText(expected);
|
|
await page.screenshot({ path: testInfo.outputPath("folded.png"), animations: "disabled" });
|
|
|
|
await editor.locator(".cm-foldPlaceholder").first().click();
|
|
await expect(editor.locator(".cm-line").first()).toHaveText(source.split("\n")[0]!);
|
|
});
|
|
}
|