Skip to content
Snippets Groups Projects
Commit b2922dca authored by James-Yu's avatar James-Yu
Browse files

Add a version update notice

parent 4481cacc
No related branches found
No related tags found
No related merge requests found
......@@ -163,33 +163,33 @@
"title": "LaTeX Workshop: All actions"
}
],
"keybindings": [
{
"command": "latex-workshop.build",
"key": "ctrl+alt+b",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.view",
"key": "ctrl+alt+v",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.tab",
"key": "ctrl+alt+t",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.synctex",
"key": "ctrl+alt+s",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.actions",
"key": "ctrl+alt+l",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
}
],
"keybindings": [
{
"command": "latex-workshop.build",
"key": "ctrl+alt+b",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.view",
"key": "ctrl+alt+v",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.tab",
"key": "ctrl+alt+t",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.synctex",
"key": "ctrl+alt+s",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
},
{
"command": "latex-workshop.actions",
"key": "ctrl+alt+l",
"when": "editorFocus && !replaceActive && !searchViewletVisible && !findWidgetVisible"
}
],
"configuration": {
"type": "object",
"title": "LaTeX Workshop configuration",
......@@ -262,7 +262,12 @@
},
"latex-workshop.view.outline.sections": {
"type": "array",
"default": ["chapter", "section", "subsection", "subsubsection"],
"default": [
"chapter",
"section",
"subsection",
"subsubsection"
],
"description": "The section names of LaTeX outline hierarchy.\nThis property is an array of case-sensitive strings in the order of document structure hierarchy. For multiple tags in the same level, seperate the tags with `|` as delimiters, e.g., `section|alternative`."
},
"latex-workshop.view.pdf.zoom": {
......@@ -340,6 +345,11 @@
"type": "boolean",
"default": true,
"description": "Display LaTeX Workshop debug log in output panel.\nThis property defines whether LaTeX Workshop will output its debug log to the log panel."
},
"latex-workshop.version": {
"type": "string",
"default": "",
"description": "Extension version information."
}
}
},
......@@ -363,13 +373,13 @@
]
},
"views": {
"explorer": [
{
"id": "latex-outline",
"name": "LaTeX Outline",
"when": "resourceLangId == latex"
}
]
"explorer": [
{
"id": "latex-outline",
"name": "LaTeX Outline",
"when": "resourceLangId == latex"
}
]
}
},
"scripts": {
......@@ -385,7 +395,7 @@
"dependencies": {
"chokidar": "^1.6.1",
"glob": "^7.1.1",
"open": "^0.0.5",
"opn": "^5.1.0",
"ws": "^1.1.1"
},
"devDependencies": {
......
import * as vscode from 'vscode'
import * as path from 'path'
import * as fs from 'fs'
import * as opn from 'opn'
import {Logger, LogProvider} from './logger'
import {Commander} from './commander'
......@@ -64,6 +66,36 @@ function obsoleteConfigCheck() {
renameConfig('viewer.hand', 'view.pdf.hand')
}
function newVersionMessage(extensionPath: string) {
fs.readFile(`${extensionPath}${path.sep}package.json`, (err, data) => {
if (err) {
return
}
const packageVersion = JSON.parse(data.toString()).version
const configuration = vscode.workspace.getConfiguration('latex-workshop')
if (configuration.get('version') === packageVersion) {
return
}
configuration.update('version', packageVersion, true)
vscode.window.showInformationMessage(`LaTeX Workshop updated to version ${packageVersion}.`,
'Change log', 'Star the project', 'Write review')
.then(option => {
switch (option) {
case 'Change log':
opn('https://github.com/James-Yu/LaTeX-Workshop/blob/master/CHANGELOG.md')
break
case 'Star the project':
default:
opn('https://github.com/James-Yu/LaTeX-Workshop')
break
case 'Write review':
opn('https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop#review-details')
break
}
})
})
}
export async function activate(context: vscode.ExtensionContext) {
const extension = new Extension()
global['latex'] = extension
......@@ -153,10 +185,9 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.window.registerTreeDataProvider('latex-outline', sectionNodeProvider)
// On startup, lint the whole project if enabled.
lintRootFileIfEnabled(extension)
obsoleteConfigCheck()
newVersionMessage(context.extensionPath)
}
export class Extension {
......
import * as vscode from 'vscode'
import * as fs from 'fs'
import * as path from 'path'
import * as open from 'open'
import * as opn from 'opn'
import * as WebSocket from 'ws'
import {Extension} from './main'
......@@ -68,7 +68,7 @@ export class Viewer {
client.ws.close()
}
this.clients[pdfFile] = {type: 'viewer'}
open(url)
opn(url)
this.extension.logger.addLogMessage(`Open PDF viewer for ${pdfFile}`)
this.extension.logger.displayStatus('repo', 'statusBar.foreground', `Open PDF viewer for ${path.basename(pdfFile)}.`)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment