Skip to content

Commit

Permalink
✨ Add "Show Output" command (#1505)
Browse files Browse the repository at this point in the history
  • Loading branch information
misode committed Jul 30, 2024
1 parent f4d4588 commit 87841f6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/user/commands.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

Show the cache folder of Spyglass in the platform-specific explorer program.

=== `spyglassmc.showOutput`

Show the output panel with the logs of the Spyglass Language Server.

=== `spyglassmc.resetProjectCache`

Reset the symbols cache for the current project.
Expand Down
8 changes: 8 additions & 0 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@
"command": "spyglassmc.showCacheRoot",
"title": "%spyglassmc.commands.showCacheRoot.title%",
"category": "Spyglass"
},
{
"command": "spyglassmc.showOutput",
"title": "%spyglassmc.commands.showOutput.title%",
"category": "Spyglass"
}
],
"menus": {
Expand All @@ -182,6 +187,9 @@
},
{
"command": "spyglassmc.showCacheRoot"
},
{
"command": "spyglassmc.showOutput"
}
]
},
Expand Down
1 change: 1 addition & 0 deletions packages/vscode-extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"spyglassmc.commands.dataHackPubify.title": "Data Hack Pubify",
"spyglassmc.commands.resetProjectCache.title": "Reset Project Cache",
"spyglassmc.commands.showCacheRoot.title": "Open Cache Folder",
"spyglassmc.commands.showOutput.title": "Show Output",
"spyglassmc.description": "Heavy language features for Minecraft: Java Edition data pack files",
"spyglassmc.displayName": "Datapack Helper Plus by Spyglass",
"spyglassmc.env.gameVersion": "The Minecraft version to use. When set to auto, the version is inferred from the `pack.mcmeta`. Other versions can be specified in a `spyglass.json` config file.",
Expand Down
12 changes: 11 additions & 1 deletion packages/vscode-extension/src/extension.mts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export async function activate(context: vsc.ExtensionContext) {

if (customCapabilities?.showCacheRoot) {
context.subscriptions.push(
vsc.commands.registerCommand('spyglassmc.showCacheRoot', async (): Promise<void> => {
vsc.commands.registerCommand('spyglassmc.showCacheRoot', async () => {
try {
await client.sendRequest('spyglassmc/showCacheRoot')
} catch (e) {
Expand All @@ -132,6 +132,16 @@ export async function activate(context: vsc.ExtensionContext) {
)
}

context.subscriptions.push(
vsc.commands.registerCommand('spyglassmc.showOutput', () => {
try {
client.outputChannel.show()
} catch (e) {
console.error('[client#showOutput]', e)
}
}),
)

return new Promise<void>((resolve) => {
client.onProgress(lc.WorkDoneProgress.type, 'initialize', (params) => {
if (params.kind === 'begin') {
Expand Down

0 comments on commit 87841f6

Please sign in to comment.