feat(editor): Fill Paragraph action (#5681)

Edit › Fill Paragraph (code.fillParagraph, IDEA's FillParagraph) re-wraps the comment or plain-text paragraph at the caret to the hard wrap column: a run of line comments with the same marker, the * lines of a block comment up to a blank line or @tag, or non-blank lines of a plain text file. Code, string literals and read-only editors are left alone. No default shortcut, as in IDEA.

Closes #5680

Co-authored-by: mansur-akhmadi <[email protected]>
Цей коміт міститься в:
Mansur Akhmadiтаmansur-akhmadi authored and GitHub committed 2026-11-25 06:26:46 +08:00
1 джерело f16cfb507b
коміт fedd5ffd4f
12 files changed
+286 -1

No files matched your search

+1
Переглянути файл
@@ -52,6 +52,7 @@ export const IDEA_ACTIONS: Readonly<Record<string, string>> = {
EditorSelectWord: "code.extendSelection",
EditorUnSelectWord: "code.shrinkSelection",
EditorDuplicateLines: "code.duplicateEntireLines",
FillParagraph: "code.fillParagraph",
CollapseRegion: "code.fold",
ExpandRegion: "code.unfold",
CollapseAllRegions: "code.foldAll",
+8
Переглянути файл
@@ -57,6 +57,14 @@ describe("IntelliJ IDEA keymap import", () => {
expect(k.unknownActions).toEqual([]);
});
it("maps Fill Paragraph, which has no shortcut in the presets", () => {
const k = parseIdeaKeymap(
`<keymap name="M" parent="Mac OS X 10.5+"><action id="FillParagraph"><keyboard-shortcut first-keystroke="alt meta Q"/></action></keymap>`,
);
expect(k.overrides["code.fillParagraph"]).toEqual([normalizeBinding("Alt+Meta+Q")]);
expect(k.unknownActions).toEqual([]);
});
it("maps Remove All Breakpoints and Remove All Breakpoints In The Current File", () => {
const k = parseIdeaKeymap(
`<keymap name="M" parent="Mac OS X 10.5+"><action id="Debugger.RemoveAllBreakpoints"><keyboard-shortcut first-keystroke="shift meta F9"/></action><action id="Debugger.RemoveAllBreakpointsInFile"><keyboard-shortcut first-keystroke="alt meta F9"/></action></keymap>`,
+1
Переглянути файл
@@ -158,6 +158,7 @@ export const intellijMacos: Record<string, string[]> = {
"code.pasteFromHistory": ["Meta+Shift+V"],
"code.sortLines": [],
"code.reverseLines": [],
"code.fillParagraph": [],
"code.unwrap": ["Meta+Shift+Delete"],
"code.foldSelection": ["Meta+."],
"editor.toggleColumnSelection": ["Meta+Shift+8"],
+1
Переглянути файл
@@ -160,6 +160,7 @@ export const intellijWindows: Record<string, string[]> = {
"code.pasteFromHistory": ["Ctrl+Shift+V"],
"code.sortLines": [],
"code.reverseLines": [],
"code.fillParagraph": [],
"code.unwrap": ["Ctrl+Shift+Delete"],
"code.foldSelection": ["Ctrl+."],
"editor.toggleColumnSelection": ["Alt+Shift+Insert"],
+1
Переглянути файл
@@ -177,6 +177,7 @@ export const vscodeMacos: Record<string, string[]> = {
"code.pasteFromHistory": [],
"code.sortLines": [],
"code.reverseLines": [],
"code.fillParagraph": [],
"code.unwrap": [],
"code.foldSelection": [],
"editor.toggleColumnSelection": [],
+2 -1
Переглянути файл
@@ -9248,5 +9248,6 @@
"Find where this component is imported and used": "查找此元件被匯入和使用的位置",
"Gradle project sync failed": "Gradle 專案同步失敗",
"Gradle could not sync {project}. Java code insight may not work until the build syncs. Fix the build, then reload the Gradle project. Cause: {cause}": "Gradle 無法同步 {project}。建置同步成功前,Java 程式碼分析可能無法正常運作。請修正建置,然後重新載入 Gradle 專案。原因:{cause}",
"Gradle could not sync {project}. Java code insight may not work until the build syncs. Fix the build, then reload the Gradle project.": "Gradle 無法同步 {project}。建置同步成功前,Java 程式碼分析可能無法正常運作。請修正建置,然後重新載入 Gradle 專案。"
"Gradle could not sync {project}. Java code insight may not work until the build syncs. Fix the build, then reload the Gradle project.": "Gradle 無法同步 {project}。建置同步成功前,Java 程式碼分析可能無法正常運作。請修正建置,然後重新載入 Gradle 專案。",
"Fill Paragraph": "填充段落"
}
+1
Переглянути файл
@@ -1014,6 +1014,7 @@
"Paste from History…": "从历史记录粘贴…",
"Sort Lines": "排序行",
"Reverse Lines": "反转行序",
"Fill Paragraph": "填充段落",
"Unwrap/Remove…": "解包/移除…",
"Basic": "基本补全",
"Quick Definition": "快速定义",