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

Support for Vue file #176

Closed
kuntau opened this issue Oct 27, 2016 · 11 comments
Closed

Support for Vue file #176

kuntau opened this issue Oct 27, 2016 · 11 comments

Comments

@kuntau
Copy link

kuntau commented Oct 27, 2016

The .vue have multiple format in it javascript, html and css, to make matter worse it also support preprocessor jade, pug, stylus, sass on the very same file.

What I got for comment only html comment <!-- -->

There is issue opened in posva/vim-vue (for multiple syntax highlighting) which address the same problem posva/vim-vue#17

Maybe something can be worked out

@adriaanzon
Copy link
Contributor

This change posva/vim-vue#42 seems to have taken care of it. It works for me now.

@tomtom
Copy link
Owner

tomtom commented Feb 9, 2017

I'm sorry I totally missed out on this issue.

Since it seems to be fixed in vim-vue, I'll close this issue.

@tomtom tomtom closed this as completed Feb 9, 2017
@adriaanzon
Copy link
Contributor

We decided to revert the vue.html.javascript.css filetype to vue, because it caused too many problems with other plugins.

I can make a pull request to support this again.

@tomtom
Copy link
Owner

tomtom commented Mar 27, 2017

This would be very much appreciated. Thanks!

@smackesey
Copy link

My vue files work fine for the most part except for when I'm using pug as an alternate templating language. The commentstring for pug is // %s (i.e. javascript-style). But in a Vue SFC pug template block I get weird behavior:

<template lang="pug">
  div
</template>

After line-commenting on div once....

<template lang="pug">
  <!-- div -->
</template>

After line-commenting on the commented line...

<template lang="pug">
  // <!-- div -->
</template>

So it looks like it is using the default filetype commentstring once, but then switching to the context-aware commentstring if I'm commenting an already-commented line...?

@tomtom
Copy link
Owner

tomtom commented Feb 15, 2019 via email

@smackesey
Copy link

Here is the requested output:

TCOMMENT: &ft = vue
TCOMMENT: ft  = vue
TCOMMENT: stx = htmlTagName
Error detected while processing function tcomment#debug#CollectInfo[5]..tcomment#GuessCommentType[7]..tcomment#filetype#Guess[42]..tcomment#syntax#GetSyntaxName:
line    7:
E716: Key not present in Dictionary: filetype =~ ft_rx
TCOMMENT: ct  = -1

@tomtom
Copy link
Owner

tomtom commented Feb 19, 2019

Sorry for not having tested that.

Is this the result from this?

<template lang="pug">
  <!-- div -->
</template>

I would expect the "<!--" to have some unexpected syntax name.

@smackesey
Copy link

My first post was the output from:

<template lang="pug">
  div
</template>

For this:

<template lang="pug">
  <!-- div -->
</template>

The output is:

TCOMMENT: &ft = vue
TCOMMENT: ft  = vue
TCOMMENT: stx = pugHtmlConditionalComment
Error detected while processing function tcomment#debug#CollectInfo[5]..tcomment#GuessCommentType[7]..tcomment#filetype#Guess[42]..tcomment#syntax#GetSyntaxName:
line    7:
E716: Key not present in Dictionary: filetype =~ ft_rx
TCOMMENT: ct  = -1

In both cases the cursor is positioned on the first character of the middle line.

@tomtom
Copy link
Owner

tomtom commented Feb 19, 2019 via email

@smackesey
Copy link

I'm not the author of the pug filetype plugin so my knowledge is limited. Here is my understanding of the situation though.

<!-- PUG CODE --> is a special kind of comment in pug (a "conditional comment"). That's presumably why attempting to comment <!-- div --> shows pugHtmlConditionalComment for stx. However, these conditional comments are an alternative and should not be toggled by the main comment mapping. The way it should work for a line with just div on it is this:

div --toggle-comment--> //- div --toggle-comment-> div.

And indeed, tcomment correctly works just like this in a standalone .pug file. The output of the :call tcomment#debug#CollectInfo()command on a line with just div in a standalone pug file is:

TCOMMENT: &ft = pug
TCOMMENT: ft  = pug
TCOMMENT: stx = htmlTagName
TCOMMENT: ct  = {'commentstring': '<!-- %s -->', 'replacements': {'&': '&#38;', '-': '&#45;'}, 'mode': '', 'filetype': 'html'}

The issue is that the behavior is for some reason different inside a pug block in a .vue file.

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

No branches or pull requests

4 participants