tecosaur / LaTeX-Utilities

An add-on to LaTeX Workshop that provides some features that go beyond the bare essentials
MIT License
486 stars 29 forks source link

error message: "Couldn't load snippets file. Is it a valid JSON?" #397

Closed Hugo-Leung closed 7 months ago

Hugo-Leung commented 7 months ago

Bug Report

Disable all the other extensions except for LaTeX Workshop and LaTeX Utilities, and check that you still see this issue.

You still see this issue?: Yes

Describe the bug

On starting vscode, an error message appear stating "Couldn't load snippets file. Is it a valid JSON?"

To Reproduce

Steps to reproduce the behaviour:

start vscode

Expected behaviour

no error message

Logs

Please paste the whole log messages here, not parts of ones. It is very important to identify problems. If you think the logs are unrelated, please say so.

LaTeX Workshop Output ``` [09:32:44.851][Logger] New log placeholder %WS1% registered for /home/hugo/seaquest/paper/jpsi-paper . [09:32:44.851][Extension] Initializing LaTeX Workshop. [09:32:45.026][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_LATEX: "" [09:32:45.071][Server] Creating LaTeX Workshop http and websocket server. [09:32:45.213][Format][Bib] Bibtex format config: {"tab":" ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]} [09:32:45.300][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":60765} . [09:32:45.368][Extension] Extension root: /home/hugo/.vscode-server/extensions/james-yu.latex-workshop-9.18.0 [09:32:45.369][Extension] $PATH: /home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/bin/remote-cli:/home/hugo/.local/bin:/home/hugo/micromamba/envs/pyroot/bin:/home/hugo/micromamba/condabin:/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/gs/gs10.01.2/bin:/mnt/c/Users/himhi/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/himhi/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin [09:32:45.369][Extension] $SHELL: /bin/bash [09:32:45.369][Extension] $LANG: C.UTF-8 [09:32:45.369][Extension] $LC_ALL: undefined [09:32:45.370][Extension] process.platform: linux [09:32:45.370][Extension] process.arch: x64 [09:32:45.370][Extension] vscode.env.appName: Visual Studio Code [09:32:45.370][Extension] vscode.env.remoteName: wsl [09:32:45.371][Extension] vscode.env.uiKind: 1 [09:32:45.372][Config] latex-workshop.latex.recipes: [{"name":"latexmk (latexmkrc)","tools":["latexmk_rconly"]},{"name":"latexmk","tools":["latexmk"]},{"name":"latexmk (lualatex)","tools":["lualatexmk"]},{"name":"latexmk (xelatex)","tools":["xelatexmk"]},{"name":"pdflatex -> bibtex -> pdflatex * 2","tools":["pdflatex","bibtex","pdflatex","pdflatex"]},{"name":"Compile Rnw files","tools":["rnw2tex","latexmk"]},{"name":"Compile Jnw files","tools":["jnw2tex","latexmk"]},{"name":"Compile Pnw files","tools":["pnw2tex","latexmk"]},{"name":"tectonic","tools":["tectonic"]}] . [09:32:45.376][Config] latex-workshop.latex.autoBuild.run: "never" . [09:32:45.385][Config] latex-workshop.view.pdf.color.dark.backgroundColor: "#3d3d3d" . [09:32:45.414][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{"] [09:32:45.416][Root] Current workspace folders: ["file://%WS1%"] [09:32:45.416][Extension] LaTeX Workshop initialized. [09:32:45.452][Root] Found root file from active editor: %WS1%/jpsi.tex [09:32:45.452][Root] Root file changed: from %WS1%/jpsi.tex to %WS1%/jpsi.tex, langID latex . Refresh dependencies [09:32:45.453][Event] ROOT_FILE_CHANGED: "%WS1%/jpsi.tex" [09:32:45.453][Cacher][Watcher] Reset. [09:32:45.454][Cacher][Watcher] Reset. [09:32:45.454][Cacher][Watcher] Reset. [09:32:45.466][Cacher] Adding %WS1%/jpsi.tex . [09:32:45.468][Cacher][Watcher] Watched %WS1%/jpsi.tex with a new watcher on %WS1% . [09:32:45.469][Event] FILE_WATCHED: "%WS1%/jpsi.tex" [09:32:45.472][Cacher] Caching %WS1%/jpsi.tex . [09:32:45.474][Cacher] Input %WS1%/author.tex from %WS1%/jpsi.tex . [09:32:45.475][Cacher] Adding %WS1%/author.tex . [09:32:45.475][Cacher][Watcher] Watched %WS1%/author.tex . [09:32:45.475][Event] FILE_WATCHED: "%WS1%/author.tex" [09:32:45.476][Cacher] Caching %WS1%/author.tex . [09:32:45.476][Cacher] Updated inputs of %WS1%/author.tex . [09:32:45.476][Cacher] Parse LaTeX AST: %WS1%/author.tex . [09:32:45.477][Cacher] Input %WS1%/table/xF_full_combined.tex from %WS1%/jpsi.tex . [09:32:45.477][Cacher] Adding %WS1%/table/xF_full_combined.tex . [09:32:45.477][Cacher][Watcher] Watched %WS1%/table/xF_full_combined.tex with a new watcher on %WS1%/table . [09:32:45.478][Event] FILE_WATCHED: "%WS1%/table/xF_full_combined.tex" [09:32:45.478][Cacher] Caching %WS1%/table/xF_full_combined.tex . [09:32:45.479][Cacher] Updated inputs of %WS1%/table/xF_full_combined.tex . [09:32:45.479][Cacher] Parse LaTeX AST: %WS1%/table/xF_full_combined.tex . [09:32:45.480][Cacher] Input %WS1%/table/pT_full_combined.tex from %WS1%/jpsi.tex . [09:32:45.480][Cacher] Adding %WS1%/table/pT_full_combined.tex . [09:32:45.480][Cacher][Watcher] Watched %WS1%/table/pT_full_combined.tex . [09:32:45.480][Event] FILE_WATCHED: "%WS1%/table/pT_full_combined.tex" [09:32:45.481][Cacher] Caching %WS1%/table/pT_full_combined.tex . [09:32:45.482][Cacher] Updated inputs of %WS1%/table/pT_full_combined.tex . [09:32:45.482][Cacher] Parse LaTeX AST: %WS1%/table/pT_full_combined.tex . [09:32:45.483][Cacher] Updated inputs of %WS1%/jpsi.tex . [09:32:45.484][Cacher] Parse LaTeX AST: %WS1%/jpsi.tex . [09:32:45.485][Event] ROOT_FILE_SEARCHED [09:32:45.541][Server] valdOrigin is http://127.0.0.1:60765 [09:32:45.662][Cacher] Parsed LaTeX AST: %WS1%/author.tex . [09:32:45.672][Cacher] Updated elements in 8.93 ms: %WS1%/author.tex . [09:32:45.673][Event] FILE_PARSED: "%WS1%/author.tex" [09:32:45.685][Cacher] Parsed LaTeX AST: %WS1%/table/xF_full_combined.tex . [09:32:45.689][Cacher] Updated elements in 4.06 ms: %WS1%/table/xF_full_combined.tex . [09:32:45.691][Event] FILE_PARSED: "%WS1%/table/xF_full_combined.tex" [09:32:45.848][Cacher] Parsed LaTeX AST: %WS1%/table/pT_full_combined.tex . [09:32:45.850][Cacher] Updated elements in 1.40 ms: %WS1%/table/pT_full_combined.tex . [09:32:45.850][Event] FILE_PARSED: "%WS1%/table/pT_full_combined.tex" [09:32:46.097][Cacher] Parsed LaTeX AST: %WS1%/jpsi.tex . [09:32:46.098][File] Calling kpsewhich to resolve elsarticle.cls . [09:32:46.254][Cacher] Bib %WS1%/reference.bib from %WS1%/jpsi.tex . [09:32:46.255][Intelli][Citation] Parsing .bib entries from %WS1%/reference.bib [09:32:46.257][Intelli][Citation] Parse BibTeX AST from %WS1%/reference.bib . [09:32:46.257][Cacher][Watcher] Watched %WS1%/reference.bib with a new watcher on %WS1% . [09:32:46.257][Event] FILE_WATCHED: "%WS1%/reference.bib" [09:32:46.258][Cacher] Updated elements in 160.34 ms: %WS1%/jpsi.tex . [09:32:46.259][Event] FILE_PARSED: "%WS1%/jpsi.tex" [09:32:46.276][Structure] Structure force updated with 0 root sections for %WS1%/jpsi.tex . [09:32:46.276][Event] STRUCTURE_UPDATED [09:32:46.279][Intelli][Citation] Parsed 33 bib entries from %WS1%/reference.bib . [09:32:46.279][Event] FILE_PARSED: "%WS1%/reference.bib" [09:32:46.281][Structure] Structure force updated with 11 root sections for %WS1%/jpsi.tex . [09:32:46.281][Event] STRUCTURE_UPDATED [09:32:54.910][Event] STRUCTURE_UPDATED [09:33:26.612][Event] STRUCTURE_UPDATED ```
LaTeX Utilities Output ``` [09:32:45] Initializing LaTeX Utilities. [09:32:45] Cannot read properties of undefined (reading 'length') [09:32:45] TypeError: Cannot read properties of undefined (reading 'length') at is.loadSnippets (/home/hugo/.vscode-server/extensions/tecosaur.latex-utilities-0.4.12/out/main.js:32:9262) at new is (/home/hugo/.vscode-server/extensions/tecosaur.latex-utilities-0.4.12/out/main.js:32:5186) at new Uo (/home/hugo/.vscode-server/extensions/tecosaur.latex-utilities-0.4.12/out/main.js:60:15544) at NA (/home/hugo/.vscode-server/extensions/tecosaur.latex-utilities-0.4.12/out/main.js:60:12358) at z.ib (/home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/out/vs/workbench/api/node/extensionHostProcess.js:156:13232) at z.hb (/home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/out/vs/workbench/api/node/extensionHostProcess.js:156:12946) at /home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/out/vs/workbench/api/node/extensionHostProcess.js:156:11081 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async c.n (/home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/out/vs/workbench/api/node/extensionHostProcess.js:140:6256) at async c.m (/home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/out/vs/workbench/api/node/extensionHostProcess.js:140:6219) at async c.l (/home/hugo/.vscode-server/bin/31c37ee8f63491495ac49e43b8544550fbae4533/out/vs/workbench/api/node/extensionHostProcess.js:140:5676) [09:32:45] Completion Watcher Initialised [09:32:45] TexCount args: -merge,-brief [09:32:45] LaTeX Utilities Started [09:32:45] TeXCount output for word: 2620+11+287 (3/8/215/5) File: jpsi.tex [09:32:45] TexCount args: -merge,-brief,-char [09:32:45] LaTeX Utilities version: 0.4.12 [09:32:45] TeXCount output for char: 14377+65+1477 (3/8/215/5) File: jpsi.tex [09:32:47] withTelemetry: onDidChangeActiveTextEditor_tex_wordcounter [09:32:54] withTelemetry: onDidChangeActiveTextEditor_tex_wordcounter [09:32:54] TexCount args: -merge,-brief [09:32:55] TeXCount output for word: 2620+11+287 (3/8/215/5) File: jpsi.tex [09:32:55] TexCount args: -merge,-brief,-char [09:32:55] TeXCount output for char: 14377+65+1477 (3/8/215/5) File: jpsi.tex ```
Developer Tools Console ``` logs here ```

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop

Additional context

Add any other context about the problem here.

leoleoasd commented 7 months ago

Hi, can you run the command latex-utilities.editLiveSnippetsFile and paste a screenshot of the prompted config?

Hugo-Leung commented 7 months ago

I hope this is what you are asking for

{
    "latex-workshop.latex.autoBuild.run": "never",
    "editor.fontSize": 18,
    "workbench.editorAssociations": {
        "*.pdf": "pdf.view"
    },
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk (latexmkrc)",
            "tools": [
                "latexmk_rconly"
            ]
        },
        {
            "name": "latexmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "latexmk (lualatex)",
            "tools": [
                "lualatexmk"
            ]
        },
        {
            "name": "latexmk (xelatex)",
            "tools": [
                "xelatexmk"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex * 2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "Compile Rnw files",
            "tools": [
                "rnw2tex",
                "latexmk"
            ]
        },
        {
            "name": "Compile Jnw files",
            "tools": [
                "jnw2tex",
                "latexmk"
            ]
        },
        {
            "name": "Compile Pnw files",
            "tools": [
                "pnw2tex",
                "latexmk"
            ]
        },
        {
            "name": "tectonic",
            "tools": [
                "tectonic"
            ]
        }
    ],
    "workbench.colorCustomizations": {},
    "editor.minimap.renderCharacters": false,
    "cSpell.userWords": [
        "aluminium"
    ],
    "latex-workshop.view.pdf.color.dark.backgroundColor": "#3d3d3d",
    "latex-utilities.zotero.latexCommand": "cite"
}
leoleoasd commented 7 months ago

I just released a fix, please try v0.4.13

Hugo-Leung commented 7 months ago

Thanks, the issue seems to be resolved