This commit is contained in:
James-Yu 2018-07-24 11:30:20 +08:00
parent ad127a9b59
commit 395d34d64c
3 changed files with 8 additions and 14 deletions

View File

@ -29,11 +29,11 @@
"onLanguage:tex",
"onLanguage:latex",
"onLanguage:doctex",
"onLanguage:pdf",
"onCommand:latex-workshop.build",
"onCommand:latex-workshop.recipes",
"onCommand:latex-workshop.view",
"onCommand:latex-workshop.tab",
"onCommand:latex-workshop.pdf",
"onCommand:latex-workshop.synctex",
"onCommand:latex-workshop.clean",
"onCommand:latex-workshop.citation",
@ -202,10 +202,6 @@
"title": "Kill LaTeX compiler process",
"category": "LaTeX Workshop"
},
{
"command": "latex-workshop.pdf",
"title": "View an arbitrary PDF file"
},
{
"command": "latex-workshop.synctex",
"title": "SyncTeX from cursor",
@ -587,13 +583,6 @@
}
},
"menus": {
"explorer/context": [
{
"when": "resourceLangId == pdf",
"command": "latex-workshop.pdf",
"group": "navigation"
}
],
"editor/context": [
{
"when": "resourceLangId == latex",

View File

@ -263,7 +263,7 @@ export class Commander {
if (!this.commandTitles) {
const commands = this.extension.packageInfo.contributes.commands.filter(command => {
return ['latex-workshop.actions', 'latex-workshop.build', 'latex-workshop.recipes',
'latex-workshop.view', 'latex-workshop.pdf', 'latex-workshop.compilerlog',
'latex-workshop.view', 'latex-workshop.compilerlog',
'latex-workshop.log', 'latex-workshop.tab'].indexOf(command.command) < 0
})
this.commandTitles = commands.map(command => command.title)

View File

@ -132,7 +132,6 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('latex-workshop.view', () => extension.commander.view())
vscode.commands.registerCommand('latex-workshop.tab', () => extension.commander.tab())
vscode.commands.registerCommand('latex-workshop.kill', () => extension.commander.kill())
vscode.commands.registerCommand('latex-workshop.pdf', (uri: vscode.Uri | undefined) => extension.commander.pdf(uri))
vscode.commands.registerCommand('latex-workshop.synctex', () => extension.commander.synctex())
vscode.commands.registerCommand('latex-workshop.clean', () => extension.commander.clean())
vscode.commands.registerCommand('latex-workshop.actions', () => extension.commander.actions())
@ -180,6 +179,12 @@ export async function activate(context: vscode.ExtensionContext) {
obsoleteConfigCheck()
extension.manager.findRoot()
}
// console.log(e.languageId, e.uri.scheme)
if (e.languageId === 'pdf' && e.uri.scheme !== 'latex-workshop-pdf') {
vscode.commands.executeCommand('workbench.action.closeActiveEditor').then(() => {
extension.commander.pdf(e.uri)
})
}
}))
context.subscriptions.push(vscode.workspace.onDidChangeTextDocument((e: vscode.TextDocumentChangeEvent) => {