Sublime Forum

Wrong comments in Svelte files

#1

Svelte files have sections with different syntaxes: one each of JavaScript, HTML, and CSS. If I try to comment out one more lines inside the HTML section, instead of enclosing them in “”, they are now prefixed with “##”, which is really unfortunate, given how complex HTML comments are when you can’t rely on the editor to insert them and have to type them yourself.

This behaviour is fairly recent, I would say it started a few months ago. There is one syntax package for Svelte and it is what I’m using. The comments that are inserted don’t come from the syntax definition. I have no idea what language even uses “##” for its comments. I also tried disabling all other packages, with no success.

I would be grateful for any advice on how to debug and fix this.

0 Likes

#2

Given it’s working as expected with only Svelte installed, it’s barely the editor to blame.

It’s more likely an issue caused by any 3rd-party package.

To find out the root cause you could…

  1. call sublime.log_commands() in ST’s console
  2. check whether an uncommon command is called when hitting the toggle command key combo.
    The default command would be command: toggle_comment {"block": false}.

It’s also possible a package is defining custom comment definitions in a *.tmPreferences file.

You’ll finally need to disable all plugins and re-enable them step by step to find the causing one.

0 Likes

#3

I found the cause: It was the Mako syntax package, which modifies the HTML syntax definition, even when it’s not in use. I left it enabled while testing previously because I assumed one syntax definition shouldn’t have any effect when it doesn’t apply to the currently open file, but evidently that’s not the case.

0 Likes

#4

That’s normally true, but Mako uses a too common scope to define toggle comment rules.

0 Likes