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

This commit is contained in:
Saint
2025-02-13 11:47:23 -05:00
committed by GitHub
parent 8059ba89c2
commit 9297920d73
4 changed files with 17 additions and 7 deletions

View File

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

View File

@@ -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",

View File

@@ -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") {

View File

@@ -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>