-
-
Notifications
You must be signed in to change notification settings - Fork 596
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
single file .vue formatting no longer works correctly #1189
Comments
I just updated VSCode and now it says View Language Server crashed every time I save. |
you could try to install vetur 0.18.0 version. It can work well. |
Rollback to 0.18.0 fixes the issue for me. |
Me too
…On Sun, Apr 7, 2019, 11:18 PM prinzt ***@***.***> wrote:
Rollback to 0.18.0 fixes the issue for me.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1189 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AARhoXZq3fR9FY4F6da-G9k1niDniKg0ks5vet8sgaJpZM4cgyxe>
.
|
Can you give one full file on which I can fully repro this issue? |
yes i'm happy to private-send you a file (but i don't want it published on forums). u can email me your email. not sure how to do private messages on github. (ps: still have problem today after full restart of everything). |
@frudman I sent you an email. |
sorry, already sent to your email. did you get it? (it was your gm email, coming from my personal gm email) |
@frudman I got it. Syntax highlighting is broken because you need to use quotes around interpolations. In line 18, something like this would do: <h4><icon v-if="foo" bar :hover="bar" /></h4> The quoteless HTML attribute usage would cause problems. This has never been working: <h4><icon v-if=foo bar :hover=bar /></h4> As for formatting, what's your config for |
thanks for looking into this. a couple of points:
I don't see a vetur config file in my project (or home directory). I'm on a mac. Is it kept somewhere else? Either that, or I'm using it with standard options. |
That's right, but Vue interpolations are not simple attribute values. That code itself wouldn't even be valid HTML5: https://mathiasbynens.be/notes/unquoted-attribute-values You can read https://code.visualstudio.com/docs/getstarted/settings to better understand VS Code settings. By default Vetur uses https://prettyhtml.netlify.com/ for template formatting. If that doesn't work for you, you can either disable it with |
agreed about the [classic] foo bar example: we do use quotes when attr vals contain spaces, '=', or other such char (which for us is rare, but for which you can see an example of this in code i sent). so, bottom line, for us to use vetur, quotes are required always, is that correct? (else no vetur?) (out of curiosity, why was this not an issue until recently (at least not for us/our code)? or even last update? was it vetur update or vscode update? just curious) |
There's no spec that says you can or cannot use unquoted attributes. But currently the Textmate grammar of Vetur doesn't support unquoted values very well.
For which version of Vetur / VS Code does this work? I tested on 1.18.0 but syntax highlighting still didn't work. |
ok. we use latest version of software, always. vs code & vetur (& others). only recent update was vetur (&, coincidentally) vs code on same day (4/4/2019). prior to that, all was well: i assume vetur was at 0.18.0 (but never checked) and vs code was at whichever version before 1.33 (i'm assuming 1.32.0) it's not a big deal. we just liked using vetur. it made code nice-and-easy for us to read on screen. no worries. [ps: prior version of vetur did work for us, at least syntax coloring did] |
You can get old downloads here: https://code.visualstudio.com/updates/v1_32 and old Vetur releases in https://github.com/vuejs/vetur/releases. https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix is how to install them. |
ok, i won't get a chance to spend much time on this but was able to do this earlier today:
BUT, before reloading, it seems to reload open files on its own, and the .vue files all display correctly! (including the file I sent you yesterday). HOWEVER, if I then explicitly reload, the files go back to bad coloring issue, although it also says version is now also back to 0.18.1 (as if it doesn't like the older version and resets to latest: I suspect I have a setting that says to auto update my extensions, somewhere; will look for that and disable it, then try again, but can't right now (sorry, deadline)) [UPDATE] Yes, I can confirm (after disabling auto-update extensions and restarting) that [at least with] 0.16.2, all syntax coloring does indeed work properly. All is well with html and javascript and css. bottom line: with all else up-to-date (vs code, extensions), and vetur back to 0.16.2 (at least, didn't try more recent yet), the coloring syntax is working properly. for now, we'll keep vetur at version 0.16.2 until hopefully more light can be shed on the problem. Thanks for all your effort. Very much appreciated. :-) IMPORTANT: I should have mentioned yesterday (sorry), the coloring issue goes past the template/html code, into the script part. If the issue is indeed a textmate (or other html-parsing) error, why would that move into the .js part of the code (a completely different parsing engine, I assume). ps2: here's a list of extensions currently loaded on vs code (most unused from past projects): |
The syntax highlighting for unquoted attributes should be fixed in #1193. |
that's great! can't wait for next version to be released! |
How can I install vetur 0.18.0? Or change 0.19.0 to 0.18.0. I'm using vscode. |
Finally got it fixed, by this comment #543 (comment)
but without "prettier.eslintIntegration", since it's deprecated now. |
A workaround that worked for me:
|
Info
Problem
After update of either Vetur (updated 4/4) or VS Code (also updated/restarted 4/4), the formatting of single-file .vue code is no longer correct (was fine until then).
I attached a snapshot of current display. Unfortunately I do not have an earlier snapshot of the correct formatting (since it was working!).
Reproducible Case
Not sure how you can reproduce it. I've closed down VSCode, restarted it. Closed code tab, reopened it. Still same [new] result.
Formatting is incorrect. Incorrect formatting is same after close/reopen. Starts right at icon closing tag (white), through closing h4 tag, through start of form below. Then seems ok/not-ok for rest of template.
Ditto for actual code (script) where color coding fails and most of the code is just white text.
All else is working fine, code is compiling/executing correctly. No other issues other than annoying (and now hard to use) formatting.
Formatting of STYLE is fine (using stylus on this file, in case that's relevant).
template issue
script issue
The text was updated successfully, but these errors were encountered: