Skip to content

Commit 461dca6

Browse files
add iconography to documentation live preview (#1290)
1 parent ea16da0 commit 461dca6

10 files changed

+77
-2
lines changed

assets/icon-font.woff

-1.41 KB
Binary file not shown.

assets/icons/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Custom Icons for the Swift extension
2+
3+
This folder contains custom iconography used in various sections of the Swift extension for VS Code.
4+
5+
All icons are compiled into a single icon font using [IcoMoon](https://icomoon.io/app). The icons must be placed at the following codes within the font file:
6+
7+
```
8+
\\E001 - swift-icon
9+
\\E002 - swift-documentation
10+
\\E003 - swift-documentation-preview
11+
```
12+
13+
Any newly added icons will need to be added to the icons contribution point in the [package.json](../../package.json) for them to be usable from within the extension.
Loading
Loading

assets/icons/icon-font.woff

1.93 KB
Binary file not shown.
Loading
Loading

assets/icons/swift-icon.svg

+6
Loading

package.json

+24-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,23 @@
3636
"swift-icon": {
3737
"description": "The official icon for the Swift programming language",
3838
"default": {
39-
"fontPath": "assets/icon-font.woff",
39+
"fontPath": "assets/icons/icon-font.woff",
4040
"fontCharacter": "\\E001"
4141
}
42+
},
43+
"swift-documentation": {
44+
"description": "The icon for the Swift documentation preview editor",
45+
"default": {
46+
"fontPath": "assets/icons/icon-font.woff",
47+
"fontCharacter": "\\E002"
48+
}
49+
},
50+
"swift-documentation-preview": {
51+
"description": "The icon used as a button for showing the Swift documentation preview editor",
52+
"default": {
53+
"fontPath": "assets/icons/icon-font.woff",
54+
"fontCharacter": "\\E003"
55+
}
4256
}
4357
},
4458
"terminal": {
@@ -88,7 +102,8 @@
88102
{
89103
"command": "swift.previewDocumentation",
90104
"title": "Preview Documentation",
91-
"category": "Swift"
105+
"category": "Swift",
106+
"icon": "$(swift-documentation-preview)"
92107
},
93108
{
94109
"command": "swift.createNewProject",
@@ -779,6 +794,13 @@
779794
"submenu": "swift.editor"
780795
}
781796
],
797+
"editor/title": [
798+
{
799+
"command": "swift.previewDocumentation",
800+
"when": "swift.supportsDocumentationLivePreview && (editorLangId == markdown || editorLangId == tutorial || editorLangId == swift)",
801+
"group": "navigation"
802+
}
803+
],
782804
"swift.editor": [
783805
{
784806
"command": "swift.run",

src/documentation/DocumentationPreviewEditor.ts

+12
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ export class DocumentationPreviewEditor implements vscode.Disposable {
4848
],
4949
}
5050
);
51+
webviewPanel.iconPath = {
52+
light: vscode.Uri.file(
53+
extension.asAbsolutePath(
54+
path.join("assets", "icons", "light", "swift-documentation.svg")
55+
)
56+
),
57+
dark: vscode.Uri.file(
58+
extension.asAbsolutePath(
59+
path.join("assets", "icons", "dark", "swift-documentation.svg")
60+
)
61+
),
62+
};
5163
const webviewBaseURI = webviewPanel.webview.asWebviewUri(
5264
vscode.Uri.file(swiftDoccRenderPath)
5365
);

0 commit comments

Comments
 (0)