Skip to content
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

Add ### multi-line comment support. #6558

Merged
merged 9 commits into from
May 8, 2024

Conversation

Moderocky
Copy link
Member

@Moderocky Moderocky commented Apr 12, 2024

Description

This adds support for multi-line comments, originally requested here.

We agreed on very strict specifications: Multi-line comments can't start or end part-way through a line (for clarity).
(So you can't do on script ### comment ### load:!)

A block comment is opened and closed with three hashtag characters ###.

###
This is a comment!!!
###

this is no longer a comment

This (###) must be the only thing on the line. This was to try and avoid breaking any existing weird comment set-ups in scripts (although multi-hashtag ### comments have only been permitted since December 2023 anyway!)

This means that three hashtags followed by some text won't start (or end) a multi-line comment.

# This is a regular comment
### This is also a regular comment
########## This is still a regular comment
###

This is a comment!!!
### this is also inside the comment

###

An error is thrown if a script opens a multi-line comment and never closes it.


Target Minecraft Versions: any
Requirements: none
Related Issues: closes 2180

@7othifaPS
Copy link

but what if some minehut users put like this

###
###
this is string

Will this is string be code or comment

@sovdeeth
Copy link
Member

but what if some minehut users put like this

###
###
this is string

Will this is string be code or comment

Code. You started a block and ended a block, so now you're back to code space.

src/main/java/ch/njol/skript/config/Node.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/config/Node.java Outdated Show resolved Hide resolved
src/main/java/ch/njol/skript/config/Node.java Show resolved Hide resolved
src/test/skript/tests/misc/block comments.sk Outdated Show resolved Hide resolved
@AyhamAl-Ali AyhamAl-Ali added the feature Pull request adding a new feature. label Apr 12, 2024
Copy link
Member

@AyhamAl-Ali AyhamAl-Ali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Kenzie ⚡

@EquipableMC
Copy link
Contributor

Will this affect if it's being used in actual code?

@sovdeeth
Copy link
Member

sovdeeth commented Apr 13, 2024

Will this affect if it's being used in actual code?

Please see the PR description:

We agreed on very strict specifications: Multi-line comments can't start or end part-way through a line (for clarity).
(So you can't do on script ### comment ### load:!)

This (###) must be the only thing on the line.

@EquipableMC
Copy link
Contributor

Oh I didn't see that sorry

@sovdeeth sovdeeth added the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Apr 13, 2024
@sovdeeth sovdeeth added the 2.9 Targeting a 2.9.X version release label May 6, 2024
@Moderocky Moderocky merged commit adac6e1 into SkriptLang:dev/feature May 8, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.9 Targeting a 2.9.X version release feature Pull request adding a new feature. feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants