tcomment_vim icon indicating copy to clipboard operation
tcomment_vim copied to clipboard

Vue scss comment bug

Open timsofteng opened this issue 5 years ago • 7 comments

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

tcomment_bug

timsofteng avatar Oct 30 '20 15:10 timsofteng

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

Please see :h tcomment-debug.

tomtom avatar Mar 28 '21 16:03 tomtom

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>

paolooo avatar Nov 25 '22 10:11 paolooo

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

tomtom avatar Nov 25 '22 20:11 tomtom

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 avatar Nov 26 '22 00:11 paolooo

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 avatar Nov 26 '22 01:11 paolooo

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

paolooo avatar Dec 07 '22 14:12 paolooo

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?

tomtom avatar Dec 07 '22 15:12 tomtom