generated from antfu/starter-vscode
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"publisher": "oeyoews", | ||
"name": "usewiki2", | ||
"displayName": "usewiki2", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"description": "", | ||
|
@@ -80,6 +80,11 @@ | |
"group": "navigation", | ||
"when": "view == usewiki2" | ||
}, | ||
{ | ||
"command": "usewiki2.opensettings", | ||
"group": "navigation", | ||
"when": "view == usewiki2" | ||
}, | ||
{ | ||
"command": "usewiki2.wikiinfo", | ||
"group": "navigation", | ||
|
@@ -129,6 +134,11 @@ | |
"command": "usewiki2.refreshwiki", | ||
"title": "Refresh", | ||
"icon": "$(refresh)" | ||
}, | ||
{ | ||
"command": "usewiki2.opensettings", | ||
"title": "设置", | ||
"icon": "$(gear)" | ||
} | ||
] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
export async function cli() { | ||
const searchQuery = '@ext:oeyoews.usewiki2'; | ||
vscode.commands.executeCommand('workbench.action.openSettings', searchQuery); | ||
} | ||
|
||
export const name = 'usewiki2.opensettings'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { notify } from '../notify'; | ||
|
||
export async function cli() { | ||
notify('开发中', 'info'); | ||
} | ||
|
||
export const name = 'usewiki2.refreshwiki'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
import * as vscode from 'vscode'; | ||
import { usewikiViewProvider } from './webviews'; | ||
|
||
import usewikiCmd, { usewikiCli } from './usewikiCmd'; | ||
import openWikiCmd, { openWikiCli } from './openWikiCmd'; | ||
import wikiInfoCmd, { wikiInfoCli } from './commands/wikiInfo'; | ||
import * as usewikiCmd from './usewikiCmd'; | ||
import * as openWiki from './openWikiCmd'; | ||
import * as wikiInfo from './commands/wikiInfo'; | ||
import * as opensetting from './commands/openSettings'; | ||
import * as refreshWiki from './commands/refreshWiki'; | ||
|
||
export async function activate(context: vscode.ExtensionContext) { | ||
const provider = new usewikiViewProvider(context); | ||
context.subscriptions.push( | ||
vscode.window.registerWebviewViewProvider('usewiki2', provider) | ||
); | ||
const disposable = vscode.commands.registerCommand(usewikiCli, usewikiCmd); | ||
const openDisposable = vscode.commands.registerCommand( | ||
openWikiCli, | ||
openWikiCmd | ||
); | ||
const wikiInfoDisposable = vscode.commands.registerCommand( | ||
wikiInfoCli, | ||
wikiInfoCmd | ||
); | ||
|
||
context.subscriptions.push(disposable, openDisposable); | ||
const cmds = [opensetting, wikiInfo, openWiki, usewikiCmd, refreshWiki]; | ||
|
||
// 注册命令 | ||
cmds.forEach((cmd: { name: string; cli: any }) => { | ||
const disposable = vscode.commands.registerCommand(cmd.name, cmd.cli); | ||
context.subscriptions.push(disposable); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import * as vscode from 'vscode'; | ||
import { getIp, getPort, enableHttps } from './config'; | ||
|
||
export default async function openWikiCmd() { | ||
export function cli() { | ||
const protocal = enableHttps() ? 'https' : 'http'; | ||
const url = `${protocal}://${getIp()}:${getPort()}`; | ||
|
||
vscode.env.openExternal(vscode.Uri.parse(url)); | ||
} | ||
|
||
export const openWikiCli = 'usewiki2.openwiki'; | ||
export const name = 'usewiki2.openwiki'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters