Skip to content

Properly handle pug comments in vue files #12

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgandt
Copy link

@jgandt jgandt commented May 8, 2022

This is actually a change in behavior as you might want to use <!-- comments in pug files.

However I believe that most people would prefer to use this comment style when writing pug files.

I don't know how to collect this data or determine people's preferences here.

I would be amenable to an override system if one was convenient, but I can't seem to let g:context#commentstring#table['vue']['vue_pug'] in any meaningful way other than adding another autoloader that clobbers these settings or is clobbered by these settings.

An Alternative

I suggest converting all of these settings to defaults that don't clobber pre-set autoloaded variables.

I can do this conversion for all settings:

...
let g:context#commentstring#table['vue'] = get(g:, 'context#commentstring#table.vue', {})
let g:context#commentstring#table['vue']['javaScript'] = get(g:, 'context#commentstring#table.vue.javaScript', '//%s')
let g:context#commentstring#table['vue']['cssStyle'] = get(g:, 'context#commentstring#table.vue.cssStyle', '/*%s*/')
...

If we follow this path, I'll update the help page to reflect the new functionality.

It's definitely not as readable or obvious, but it does prevent clobbering. I can implement it with ifs too if you would prefer, but that would probably be even worse.

Totally happy to discuss any alternative ways forward!

This is actually a change in behavior as you might want to use `<!--` comments in pug files.

However I believe that most people would prefer to use this comment style when writing pug files.

I don't know how to collect this data or determine people's preferences here.

I would be amenable to an override system if one was convenient, but I can't seem to `let g:context#commentstring#table['vue']['vue_pug']` in any meaningful way other than adding another autoloader that clobbers these settings or is clobbered by these settings.

I could suggest converting all of these settings to defaults that don't clobber pre-set autoloaded variables.

I can do this conversion, just let me know:
```
let g:context#commentstring#table['vue'] = get(g:, 'context#commentstring#table.vue', {})
let g:context#commentstring#table['vue']['javaScript'] = get(g:, 'context#commentstring#table.vue.javaScript', '//%s')
let g:context#commentstring#table['vue']['cssStyle'] = get(g:, 'context#commentstring#table.vue.cssStyle', '/*%s*/')
```

If we follow this path, I'll update the help page to reflect the new option.

It's definitely not as readable or obvious, but it does prevent clobbering. I can implement it with `if`s too if you would prefer, but that would probably be even worse.

Totally happy to discuss any alternative ways forward!
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

Successfully merging this pull request may close these issues.

1 participant