While developing GitLink, I needed code highlighting functionality, so I researched highlight.js and discovered some implementation details worth noting.

Import highlight.js

For web pages requiring CDN import or direct src import, you should not use highlight.js resources directly, but rather use highlightjs/cdn-release.

For projects involving build tools, you should use the npm package of highlight.js.

Read more »

Using keyboard controls with OpenEmu on a Mac can be inconvenient. I have an Xbox console, and I discovered that it can be connected to a Mac for playing OpenEmu games. Here’s how to set it up.

Connecting Xbox Controller to Mac via Bluetooth

  1. Open the Mac’s Bluetooth settings and select Add Device.
  2. Press the pairing button on the Xbox controller, and Mac will automatically detect it.
  3. Once found, select the Xbox device to establish the connection.

Read more »

Recently, while implementing a JSON data editor using Monaco editor, I discovered a method to implement JSON Schema-based intelligent suggestions to enhance user experience. Here’s what I learned.

Implementation

Using Monaco-editor’s language service to implement JSON Schema-based intelligent suggestions.

Setting up JSON Schema

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
schemas: [
{
uri: "http://myschema/abi-schema.json",
fileMatch: [model.uri.toString()],
schema: {
type: "array",
items: {
type: "object",
required: ["type"],
properties: {
name: {
type: "string",
description: "Function or event name"
},
type: {
type: "string",
enum: ["function", "event", "constructor"],
description: "Type: function, event, or constructor"
},
inputs: {
type: "array",
description: "Input parameters",
items: {
type: "object",
properties: {
name: {
type: "string",
description: "Parameter name"
},
type: {
type: "string",
description: "Parameter type"
}
}
}
}
}
}
}
}
]
})
Read more »

Recently, while developing the gitlink plugin, I encountered an issue loading node_modules resources in WebView. Although CDN resources could be used directly, loading local resources is faster. Here’s how to solve the loading of node_modules resources.

Configuration

  1. Install npm dependency
1
npm install @highlightjs

Note that this should be a dependency, not a dev dependency.

Read more »

Recently, I needed to implement internationalization for my VSCode extension. Since the official documentation on this topic was sparse, with only an example provided, I’ll summarize how to implement internationalization here.

Internationalization can be divided into two categories: menu internationalization and extension content internationalization, such as prompt messages.

Configure package.json

1
2
3
4
5
6
7
8
"contributes": {
"commands": [
{
"command": "gitlink.openInGitHub",
"title": "%command.openInGitHub.title%"
}
]
}
Read more »
0%