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

Hovering doesn't work for me at all (v5.13.0) #918

Closed
sloth3toe opened this issue Oct 25, 2018 · 13 comments · Fixed by #962
Closed

Hovering doesn't work for me at all (v5.13.0) #918

sloth3toe opened this issue Oct 25, 2018 · 13 comments · Fixed by #962

Comments

@sloth3toe
Copy link

sloth3toe commented Oct 25, 2018

Description

I've been updating the extension regularly, currently at 5.13.0. I've noticed that the changelog mentioned some hovering ability but only looked into it now. I noticed that it doesn't work for me at all, hence I never noticed this new feature.

Log messages

No error with compiling. Nothing unusual in the log file.

LaTeX Workshop Output ``` [16:24:16] LaTeX log parsed with 0 messages. [16:24:16] Recipe of length 1 finished. [16:24:16] Successfully built test.tex ```

How to reproduce

I tried a very minimal example as suggested by @viktorstrate #856 (comment).

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
	e=mc^2
\end{align*}

$ e=mc^2 $
\end{document}

Note that all settings regarding Hovering are the default ones, i.e., the feature should be enabled.

Expected behavior

I should be able to hover and preview the math content.

Actual behavior

Nothing, just like before this feature ever existed.

@Astrantia
Copy link
Contributor

@sloth3toe go in Developer Tools then in Console and then hover over $ e =mc² $. See if there are logs.

@sloth3toe
Copy link
Author

Thanks for checking in and sorry for being slow. I'm actually unsure how to follow the instructions. In the Command Palette there is an option called "Developer: Show Logs", is that it? And which of the 4 options, Main, Shared, Window, Extension Host, should I be looking at?

@sloth3toe
Copy link
Author

This is what I found in the Log (Window) that may be relevant:

[2018-10-25 16:50:13.697] [renderer1] [error] Unexpected token } in JSON at position 6723: SyntaxError: Unexpected token } in JSON at position 6723
	at JSON.parse (<anonymous>)
	at t.HoverProvider.getColor (/Users/XX/.vscode/extensions/james-yu.latex-workshop-5.13.0/out/src/main.js:370:82872)
	at t.HoverProvider.provideHover (/Users/XX/.vscode/extensions/james-yu.latex-workshop-5.13.0/out/src/main.js:370:80879)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:500:127
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:108:368
	at new n.Class.derive._oncancel (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:85:776)
	at Object.t.asThenable (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:108:333)
	at e.provideHover (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:500:86)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:514:826
	at e._withAdapter (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:512:91)
	at e.$provideHover (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:514:788)
	at t._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:640:888)
	at t._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:640:554)
	at t._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:639:60)
	at t._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:638:59)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:635:926
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:98:138
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:99:496)
	at a (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:154:213)
	at Socket._socketDataListener (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:154:432)
	at emitOne (events.js:116:13)
	at Socket.emit (events.js:211:7)
	at addChunk (_stream_readable.js:263:12)
	at readableAddChunk (_stream_readable.js:250:11)
	at Socket.Readable.push (_stream_readable.js:208:10)
	at Pipe.onread (net.js:594:20)

@Astrantia
Copy link
Contributor

@Astrantia
Copy link
Contributor

@sloth3toe What color theme are you using for vscode?

@sloth3toe
Copy link
Author

@Astrantia
Copy link
Contributor

@sloth3toe Try changing to default vscode themes and see if this issue persists. I suspect the theme you are using is broken (invalid json). If the issue persists with the default themes then Latex Workshop is at fault. If not, this issue isn't related to this extension and can be closed.

@sloth3toe
Copy link
Author

It is indeed the theme. Any tip for what could be so wrong with the theme, in the case I want to modify it later? Thanks!

@Astrantia
Copy link
Contributor

@sloth3toe Nothing specific, debug this in json validator maybe https://github.com/ginfuru/vscode-better-solarized-dark/blob/master/themes/Better%20Solarized%20Dark-color-theme.json

@James-Yu Will it be better if latex workshop defaults to the default colors if the theme is broken? What about adding a friendly message tooltip to let the users know their theme's json is to blame?

@sloth3toe
Copy link
Author

FYI: Apparently it's because there are a bunch of comments or commented out lines (starting with //) and these aren't considered valid.

@Astrantia
Copy link
Contributor

Astrantia commented Oct 25, 2018

@James-Yu https://www.npmjs.com/package/strip-json-comments should this be added?
JSON.parse(stripJsonComments(Theme));

@James-Yu
Copy link
Owner

@Astrantia You may noticed that https://github.com/James-Yu/LaTeX-Workshop/blob/master/src/providers/hover.ts#L138 already had comments stripped. May anyone look into the specific theme and see what happened to the comment-stripping function? I might be away from keyboard for a while.

@tamuratak
Copy link
Contributor

The cause is that the JSON file of Better Solarized Dark is not valid even after comments deleted. , at the ends of line 247 and line 255 should be removed.

link

    {
      "name": "Attributes",
      "scope": "entity.other.attribute-name",
      "settings": {
        "foreground": "#6C71C4",        <-- here !
        // "fontStyle": "italic"
      }
    },
    {
      "name": "Numbers",
      "scope": "constant.numeric ",
      "settings": {
        "foreground": "#D33682",        <-- here !
        // "fontStyle": "italic"
      }
},

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants