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

Vue scss comment bug #277

Open
timsofteng opened this issue Oct 30, 2020 · 7 comments
Open

Vue scss comment bug #277

timsofteng opened this issue Oct 30, 2020 · 7 comments

Comments

@timsofteng
Copy link

Hey. Looks like I cought bug in vue file in style region.
Look at the gif please.
Thanks.

tcomment_bug

@tomtom
Copy link
Owner

tomtom commented Mar 28, 2021

Could you please send me more information about the syntax styles at the respective cursor positions?

Please see :h tcomment-debug.

@paolooo
Copy link

paolooo commented Nov 25, 2022

Commenting is correct:

Screenshot 2022-11-25 at 6 41 11 PM

But uncommenting is not:

Screenshot 2022-11-25 at 6 41 56 PM

The code is. I think the issue is lang="scss"

<style lang="scss">
.player {
  min-width: 44px;
  background-color: #FF0000;
}
</style>

@tomtom
Copy link
Owner

tomtom commented Nov 25, 2022

As I said before I would need further information as described in :h tcomment-debug.

@paolooo
Copy link

paolooo commented Nov 26, 2022

Hi @tomtom - I followed the instructions on your doc.

1. Make sure 'filetype' is set correctly.
2. Place the cursor at an appropriate position -- e.g. the first non-blank
     character of a line of code.
3. Call |tcomment#debug#CollectInfo()|.
4. File an issue on github and post the output of `:call
     tcomment#debug#CollectInfo()`. The output will also be copied to the
     clipboard.
  1. I placed the cursor at line 381
  2. Then executed :call tcomment#debug#CollectInfo()
  3. See the output in the screenshot below.

Screenshot 2022-11-25 at 6 41 56 PM

Below is the 2 debug output from previous comment.

Before commenting

TCOMMENT: &ft = vue => vue
TCOMMENT: stx = cssMediaProp => cssMediaProp
TCOMMENT: ct  = {'_args': {'beg': 381, 'fallbackFiletype': '', 'end': 381, 'filetype': 'vue', 'comment_mode': ''}, 'commentstring': '/* %s */', 'mode': '', 'filetype': 'css'}

Before Uncommenting

TCOMMENT: &ft = vue => vue
TCOMMENT: stx = sassCssComment => sassCssComment
TCOMMENT: ct  = {'_args': {'beg': 381, 'fallbackFiletype': '', 'end': 381, 'filetype': 'vue', 'comment_mode': ''}, 'commentstring': '<!--%s-->', 'mode': '', 'whitespace': 'both'}

Please let me know if I miss something.

@paolooo
Copy link

paolooo commented Nov 26, 2022

I wonder how does tcomment_vim detect the language of the code because typically in a single .vue file it has 3 languages.

<script>
 // js code
</script>

<template>
  // html code
</template>

<style>
  // css code
</style>

Does the tlib_vim do the detection?

@paolooo
Copy link

paolooo commented Dec 7, 2022

Hi @tomtom, is the information above not enough? Please let me know. Thanks.

@tomtom
Copy link
Owner

tomtom commented Dec 7, 2022

The language is detected on basis of the style that is used for highlighting. In almost all languages, the prefix of the style name is the language that should be used for commenting. For some syntax plugins, this doesn't work but im most of these cases we can derive the comment style from the style name nevertheless.

You might want to check the closed issues if there is another syntax plugin for vue for which this problem was already solved.

Could you please also tell me how the code in the initial post should actually be commented. Would it suffice to match the sassCssComment style to the css filetype?

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

3 participants