Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live Share Integration #2228

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[![rating](https://vsmarketplacebadge.apphb.com/rating-short/James-Yu.latex-workshop.svg)](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/James-Yu/LaTeX-Workshop/master/LICENSE.txt)

[![](https://aka.ms/vsls-badge)](https://aka.ms/vsls)

[![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/James-Yu/LaTeX-Workshop.svg)](https://github.com/James-Yu/LaTeX-Workshop/issues)
[![Percentage of issues still open](https://isitmaintained.com/badge/open/James-Yu/LaTeX-Workshop.svg)](https://github.com/James-Yu/LaTeX-Workshop/issues)

Expand Down
80 changes: 78 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1862,6 +1862,11 @@
],
"default": "Highlight Duplicates",
"markdownDescription": "How to handle duplicates found by the bibtex sorting functions. Duplicates are decided according to the `bibtex-format.sortby` config."
},
"latex-workshop.liveshare.outDir": {
"type": "string",
"default": "",
"markdownDescription": "The location of the output directory for PDFs when joined to a Live Share session."
}
}
},
Expand Down Expand Up @@ -1952,6 +1957,7 @@
"pdfjs-dist": "2.4.456",
"strip-json-comments": "^3.0.1",
"tmp": "^0.2.1",
"vsls": "^1.0.2532",
"workerpool": "^6.0.0",
"ws": "^5.1.1"
},
Expand Down
13 changes: 12 additions & 1 deletion src/commander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ export class Commander {
return
}
}

if (this.extension.liveshare.isGuest) {
const pdfFile = this.extension.manager.tex2pdf(pickedRootFile, true)
if (!fs.existsSync(pdfFile)) {
await this.extension.liveshare.getPdfPromise
}
}

const configuration = vscode.workspace.getConfiguration('latex-workshop')
const tabEditorGroup = configuration.get('view.pdf.tab.editorGroup') as string
if (mode === 'browser') {
Expand Down Expand Up @@ -304,7 +312,10 @@ export class Commander {
this.extension.logger.addLogMessage(`GOTOSECTION command invoked. Target ${filePath}, line ${lineNumber}`)
const activeEditor = vscode.window.activeTextEditor

vscode.workspace.openTextDocument(filePath).then((doc) => {
const openDocPromise = this.extension.liveshare.isGuest
? vscode.workspace.openTextDocument(vscode.Uri.parse(filePath.replace(/\\/g, '/')).with({ scheme: 'vsls' }))
: vscode.workspace.openTextDocument(filePath)
openDocPromise.then((doc) => {
vscode.window.showTextDocument(doc).then(() => {
vscode.commands.executeCommand('revealLine', {lineNumber, at: 'center'})
if (activeEditor) {
Expand Down
Loading