Переглянути джерело

Add setting to enable/disable documentation minimap (#786)

Saint 6 місяців тому
батько
коміт
9297920d73

+ 0 - 4
media/docs.css

@@ -1,7 +1,3 @@
-body {
-	margin-right: 200px;
-}
-
 a {
 	text-decoration: none;
 }

+ 5 - 0
package.json

@@ -258,6 +258,11 @@
 					"maximum": 200,
 					"description": "Scale factor (%) to apply to the Godot documentation viewer."
 				},
+				"godotTools.documentation.displayMinimap":{
+					"type": "boolean",
+					"default": true,
+					"description": "Whether to display the minimap for the Godot documentation viewer."
+				},
 				"godotTools.editorPath.godot3": {
 					"type": "string",
 					"default": "godot3",

+ 10 - 1
src/providers/documentation.ts

@@ -114,8 +114,17 @@ export class GDDocumentationProvider implements CustomReadonlyEditorProvider {
 		}
 
 		const scaleFactor = get_configuration("documentation.pageScale");
-
 		panel.webview.html = this.htmlDb.get(className).replaceAll("scaleFactor", scaleFactor);
+
+		const displayMinimap = get_configuration("documentation.displayMinimap");
+		if (displayMinimap) {
+			panel.webview.html = this.htmlDb.get(className).replace("displayMinimap", "initial;");
+			panel.webview.html = this.htmlDb.get(className).replace("bodyMargin", "200px;");
+		} else {
+			panel.webview.html = this.htmlDb.get(className).replace("bodyMargin", "0px;");
+			panel.webview.html = this.htmlDb.get(className).replace("displayMinimap", "none;");
+		}
+
 		panel.iconPath = get_extension_uri("resources/godot_icon.svg");
 		panel.webview.onDidReceiveMessage((msg) => {
 			if (msg.type === "INSPECT_NATIVE_SYMBOL") {

+ 2 - 2
src/providers/documentation_builder.ts

@@ -78,12 +78,12 @@ export function make_html_content(webview: vscode.Webview, symbol: GodotNativeSy
 
 			<title>${symbol.name}</title>
 		</head>
-		<body style="line-height: scaleFactor%; font-size: scaleFactor%;">
+		<body style="line-height: scaleFactor%; font-size: scaleFactor%; margin-right: bodyMargin">
 			<main>
 				${make_symbol_document(symbol)}
 			</main>
 
-			<canvas id='minimap'></canvas>
+			<canvas id='minimap' style="display: displayMinimap"></canvas>
 			
 			<script src="${pagemapJsUri}"></script>
 			<script>