0

I am building a custom language extension, and am having issues with lineComment in language-configuration.json. My language, oddly, uses "@@" as a line Comment, and I cannot get this to work.

I have tried @@, @@, and so on.

Any tips?

(Updated from a comment):

This is the entirety of my language-configuration.json:

{
     "comments": {
         // single line comment
         "lineComment": "@@"
     },
     // symbols used as brackets
     "brackets": [
         ["{", "}"],
         ["[", "]"],
         ["(", ")"]
     ],
     "autoClosingPairs": [
         ["{", "}"],
         ["[", "]"],
         ["(", ")"]
     ],
     "surroundingPairs": [
         ["{", "}"],
         ["[", "]"],
         ["(", ")"]
     ] }
cssyphus
  • 37,875
  • 18
  • 96
  • 111
Rook
  • 11
  • 3

1 Answers1

0

This is very similar to the traditional C++ line comment. Here's what I use in my syntax repository:

    {
      "name": "comment.line.double-slash",
      "match": "\/\/.*"
    }

I guess you tried already:

    {
      "name": "comment.line.double-at",
      "match": "\@\@.*"
    }

? I'm not sure if you even need to escape the @ sign, since it has no special meaning in JS regular expressions AFAIK.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
  • I have tried that. Not sure why it didn't work one of the two ways. – Rook Jun 23 '17 at 12:22
  • Then maybe you have a conflicting rule so that this one never comes to match? Try disabling all other rules and just have this comment rule in your language spec. That should then work. – Mike Lischke Jun 23 '17 at 13:16
  • This is the entirety of my language-configuration.json: `{ "comments": { // symbol used for single line comment. Remove this entry if your language does not support line comments "lineComment": "@@" }, // symbols used as brackets "brackets": [ ["{", "}"], ["[", "]"], ["(", ")"] ], "autoClosingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"] ], "surroundingPairs": [ ["{", "}"], ["[", "]"], ["(", ")"] ] }` – Rook Jun 24 '17 at 04:05
  • However, what I gave you in my answer is not from the language configuration, but the theme file (often .tmTheme is used, but you can also use a json file) [look here](https://github.com/mike-lischke/vscode-antlr4/blob/master/syntaxes/antlr.json). – Mike Lischke Jun 24 '17 at 13:22
  • Ah, thank you sir. I don't have a .thTheme file in the structure that Yeoman built out for me, so I am researching how to build one and where to put it in the file structure that exists for my extension. – Rook Jun 24 '17 at 14:23
  • I have found this GREAT piece of advice: https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_adding-a-new-color-theme When I check the TM Scopes with the comment '@@' selected, it tells me 'token type: Other' with 'No theme selector'. I think that this is teaching me more as I go. – Rook Jun 24 '17 at 14:36