PrestonKnopp / language-gdscript

gdscript language grammar package for atom.io
https://atom.io/packages/lang-gdscript
MIT License
32 stars 9 forks source link

Multiline Commenting Not Colored Correctly? #9

Closed Volcanic-Penguin closed 5 years ago

Volcanic-Penguin commented 5 years ago

Hey, first off big thanks for making a syntax highlighting and autocompletion plugin for GDScript, overall it works great.

In GDScript you can comment out mutliple lines of code by using """ at beginning and end of the code, but at least for me when I try this in Atom it colors the code as if it was a text string.

I get if maybe this is hard to do, I tried to do it myself in the custom stylesheet and couldn't find a way to differentiate between strings and multiline comments.

PS. It would be great if the plugin could also handle the other filetypes like .tres .cfg .godot, but maybe that's outside of the scope of the plugin. It seems to handle .tscn files properly.

PrestonKnopp commented 5 years ago

Hi, thanks for posting an issue. I just published an update with the multi string comment change and added .tres to the file list. I didn't add .cfg or .godot because it doesn't highlight those very well. However, they are in INI format so you could use another package like: https://atom.io/packages/language-ini for those.

Let me know if the update works for you (it's on atom.io).

Volcanic-Penguin commented 5 years ago

Whoa awesome work, well done.

I downloaded the atom package you suggested and then added a little bit of code to the .atom/config.cson file to associate all the filetypes to INI:

"*":
  autoprefixer:
    runOnSave: true
  core:
    // added the following
    customFileTypes:
      "source.ini": [
        "import"
        "godot"
        "md5"
      ]

And now all the files are nicely colored!

Multiline comment coloring is working well as well!

I found one little issue which is that it doesn't work if the """ is all the way to the left without any indentation, but I can live with that.

Thanks!

PrestonKnopp commented 5 years ago

Great! I'm glad that works for you.

I found one little issue which is that it doesn't work if the """ is all the way to the left without any indentation, but I can live with that.

I tried to fix this now but it ended up being tougher than I expected. Hopefully it is not too bothersome because I am going to shelf it for now.

Volcanic-Penguin commented 5 years ago

Alright cool, that's fine.

I ended up also installing tabs-to-spaces to automatically convert spaces to tabs for the whole file on save.

PrestonKnopp commented 5 years ago

Hey, good news, just got multiline docstrings properly styled as comments: f072c8e.

Caveat is it's only with the tree-sitter grammar.