Custom Function Comments V1.3 | Hidden Comment API, Markdown Support, and more!

About

Gain access to all of the hidden comment features used by official roblox api and more through custom html flags/blocks in function comments.

API

  • <custom> = Marks a function response for custom flags. This must be the first word of your comment
  • <dep> = Adds the Enum.CompletionItemTag.Deprecated tag to your function response, marking it as deprecated (strikethrough).
    • [NOTE]: This will entirely hide the autocomplete response if your function is under a table. This is likely a bug with the official deprecation tag implementation. However, you can alternatively use this bug as a way to intentionally hide private table function autocomplete responses.
  • <doc>link</doc> = Adds an embeded documentation link to your comment.
    • [NOTE]: Unfortunately, Roblox will only embed links under their own domain at the moment.
  • <cs> = Treats everything in the comment under the flag as an official code sample, embedding it as such.
    • [NOTE]: If your code sample has scopes, you must convert the indentation to spaces, as all tabs are filtered out when parsing through a code comment
  • <nb>
</nb> = Replaces all line breaks within the block with a space, preventing your comment from being abruptly cutoff.
    • [NOTE]: You are not required to close a “NoBreak” block (</nb) - purposefully omitting it will apply the effects to the remaining portion of the string, essentially giving it the functionality of a flag.
  • <md> = Marks your comment for markdown syntax parsing to automatically translate into the equivalent html block.
    • [NOTE]: Markdown blocks must be closed, incomplete markdown syntax will not be recognized. Use \ before markdown characters to use them normally (i.e \* or \**)
    • The current list of supported markdown syntax is: (Note that these are the only ones possible at this moment given the html tags roblox will embed)
      • **text** for bold text (<strong>)
      • *text* for italic text (<em>)
      • ^text^ for Ëąá”˜á”–á”‰ÊłËąá¶œÊłá¶Šá”–á”— (<sup>)
      • `text` for code (<code>)
      • ``` As an alternative code sample marker (Not required to be closed)

Gallery

Setup

Plugin Link: Custom Function Comments (Like the plugin? Don’t forget to leave a rating so it gets pushed to more people!)

Interested in more scripting qol improvements? Check out my other plugins!
Table Function Autocomplete
Anonymous Function Autocomplete

22 Likes

This actually looks really useful, just wondering, does this work with the Show Deprecated Objects (or whatever it’s called) setting?

3 Likes

This is using the official deprecated autocomplete response tag, so if normal deprecated functions follow that setting, this should too.

2 Likes

Update V1.1

  • Added a markdown html flag to parse your comment for markdown syntax to automatically translate into the equivalent html block.
    The current list of supported markdown syntax is: (Note that these are the only ones possible at this moment given the html tags roblox will embed)
    • **text** for bold text (<strong>)
    • *text* for italic text (<em>)
    • ^text^ for Ëąá”˜á”–á”‰ÊłËąá¶œÊłá¶Šá”–á”— (<sup>)
    • `text` for code (<code>)
  • [Note]: Markdown blocks must be closed, incomplete markdown syntax will not be recognized. Use \ before markdown characters to use them normally (i.e \* or \**)
  • Furthermore, every custom html tag/block will remove a trailing line break following its invocation to allow for a common usage pattern where line breaks are immediately used after a tag/block for readability

If you have any further suggestions for this plugin, don’t hesitate to recommend them in this thread!

6 Likes

Update V1.2

3 Likes

:woot: This is awesome! While I liked how Roblox started showing user documentation for functions, I disliked how it included every line break, which made my comments look somewhat sloppy.

This plugin fixes this (with its <nb> tag), and will let me write descriptions that blend in better with Roblox’s official ones (ignoring my poor English nowadays). Honestly, this is how the feature should’ve worked officially; The Markdown formatting makes it easier to read more detailed descriptions, and code examples could be useful for other people using community module resources.


:happy3: I wish this didn’t require a plugin at all, but your plugin fixed the issues I had with the official tooltips; Thank you for making this plugin, though!

2 Likes

Hey, just a tip! Instead of having to write (takes nil, returns vector2), you can actually type annotate a return value for a function!

local function getJoystickOffset(): (Vector2)

Yeah, it’s unfortunate this can’t be done with Roblox by default.

Something else that would be useful that Roblox does is only give the description of the current argument as you’re writing it. Why can’t we do this? No clue.

Another thing I noticed with this is that if you hover over a function rather than write it and view the autocomplete, the <.custom> and other tags show.

2 Likes

Unfortunately, the Script Editor API available to plugin developers doesn’t include the ability to modify hover responses, or individual parameter responses. So until that happens the scope of this module will remain limited to autocomplete responses.

3 Likes

Glad to hear you appreciate the plugin!
As a quick tip, to improve the readability of your comment from the scope of its declaration and for those without this plugin, you can actually line break after invoking a tag, as the plugin will automatically filter out any immediate whitespace following a tag invocation.

Furthermore, the <cs> tag isn’t a block that needs to be closed as, considering you can only embed 1 code comment, the rest of the comment following its invocation will be treated as part of it.

Moreover, the <nb> tag is applied after the code sample tag is processed, meaning that you aren’t required to close an <nb> tag if unless you specifically want a paragraph to line break mid-way.

All to say that the intended use case of this plugin for a function comment like that is

--[[<custom><md>
	**GetJoystickOffset** (takes nothing, returns `Vector2`)
<nb>
	An alias for [module]:GetMoveVector(), ...
<cs>
	local test = true
	for i = 1, 10 do
	    print("Hello, world", i)
	end
]]--
3 Likes

Ah, I didn’t know the parser was that flexible. I updated the description to use this style and it does look neater. (I also replaced the placeholder code example.)

While editing the description, I removed the first line, since it’s redundant with Roblox’s larger built-in “header” text. (It looks better like this, so it was a good idea!)

Originally, I would always write the function’s name followed by the types it takes and returns, so I could refer to it when I went to use or edit a function in my ModuleScripts, but it’s pointless now that user-made functions show these detailed tooltips and I try to always specify variables’ types when they’re created.

2 Likes

instead of you should support markdown code samples

" ``` "

3 Likes

Looks great! If you plan to release this to the public, I’d recommend placing the tags in the way he recommended so that it looks cleaner and easier to ignore if the person reading does not own the plugin.

(remove the indentation on <.cs>)

2 Likes

Markdown Code Samples would make sense if you could apply a code sample midway through a comment, but unfortunately, roblox only allows code sample embeds after the actual comment.

I initially opted for an html tag to convey the fact that all text under the tag would be converted into a code comment, but if you still prefer markdown embeds despite the nature of code comment embeds, I could simply make it so any text under a markdown code embed block is removed.

Furthermore, do you have any ideas for markdown syntax that could denote the <nb> html block?

1 Like

You could always have the option for both. When you think about it logically, it takes less effort to type ``` even if you aren’t making it public. If you are, most people who use resources know that the ``` syntax denotes a code block, making it easier for people without the plugin to understand it’s a code sample. It’ll also look cleaner to them. If you do decide to make this change, it would be nice if the closing ``` was removed from the documentation as well, just so we can include it to look better for non-plugin users.

2 Likes

Update V1.3

  • Added the markdown code embed syntax (```) as a way to specify code samples.

    • As only 1 code sample is able to be embeded, the <cs> tag is processed first and will take priority over the markdown code embed syntax.
      image
  • For those adamant on using closing tags for code samples (</cs> or ```) for the sake of consistency (despite the fact that the entire rest of the comment following a code sample tag is processed as the code sample), closing tags (and any preceding line breaks/whitespace) are now automatically filtered out of code samples.

image

4 Likes

I can not thank you enough for this. I’m too lazy to port my project to VSCode, so this is a lifesaver. Thank you so much, I love this project.

2 Likes