-
Notifications
You must be signed in to change notification settings - Fork 103
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
Incorrect TypeScript comment style on Vue files #266
Comments
Could you please post the output of `:echo tcomment#debug#CollectInfo()`
with the cursor placed on the locations in question. Please see also
`:help tcomment-debug`.
Regards
|
In an example with: toggleModal: {
type: Function,
required: true
}, Commenting each line I get: toggleModal: {
// type: Function,
<!-- required: true -->
}, The result of your command is, on the first line:
On the second line:
|
Hi. I'm just going to say second on this. Here is my debug info
I should add that sometimes tcomment does get it right with |
I also have problems in Vue files, specifically with Pug. Some lines in Pug get detected as HTML and an HTML comment style is used. This has been discussed before in #176. I attempted to debug the issues myself. The code is dense and hard to understand for an outsider, but tComment is attempting to deduce the filetype, and thus comment string to use, from the syntax groups around the cursor. I'm not sure of how this algorithm works. Something I think would really help here is a little clarification in the docs of how embedded filetypes are detected and how exactly users can configure it to override the default mechanism. Right now the docs are pretty confusing. There appear to be many different functions for doing embedded filetype detection: (BTW, the tag name for Alternatively, (and IMHO even better), just let the user provide a hook that performs the filetype detection. This is an easy solution for @tomtom that takes the burden of handling edge case embedded filetype detection off his shoulders. Shougo's https://github.com/Shougo/context_filetype.vim is a dedicated plugin for detecting embedded filetypes (it works great in Vue files). So you could just do something like this:
If this function were defined, it would be called in place of tComment's detection algorithm. |
This is an example of how these lines are commented when the language is TypeScript:
I've discovered that this occur inside braces, but not in every case: if the command is triggered from a line that contains the brace, it may work correctly.
When setting the language to JavaScript, the comments are done correctly.
The text was updated successfully, but these errors were encountered: