Skip to content

Commit

Permalink
Add setting to enable/disable documentation minimap (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnoel-dev authored Feb 13, 2025
1 parent 8059ba8 commit 9297920
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 0 additions & 4 deletions media/docs.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
body {
margin-right: 200px;
}

a {
text-decoration: none;
}
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 10 additions & 1 deletion src/providers/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
4 changes: 2 additions & 2 deletions src/providers/documentation_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 9297920

Please # to comment.