Skip to content

@enum and @alias comments rendered as markdown - #3258

Open
tommaisey wants to merge 6 commits into
LuaLS:masterfrom
tommaisey:render-alias-enum-markdown
Open

tommaisey wants to merge 6 commits into
LuaLS:masterfrom
tommaisey:render-alias-enum-markdown

Conversation

@tommaisey

Copy link
Copy Markdown
Contributor

At present these are rendered as blocks of code. This isn't ideal - most of the other documentation/hovers are rendered as formatted markdown. Now these are too, and I think this looks better.

@C3pa

C3pa commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

Hi tommaisey! Could you provide some before/after pics?

@tommaisey
tommaisey force-pushed the render-alias-enum-markdown branch 2 times, most recently from 2078687 to 8d12152 Compare March 23, 2026 10:50
@tommaisey

Copy link
Copy Markdown
Contributor Author

@C3pa Sorry for the long delay. I've been very busy at work. I rebased the branch. Here are some screenshots.

Before:
alias-before

After:
alias-after

@C3pa

C3pa commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

@C3pa Sorry for the long delay. I've been very busy at work. I rebased the branch. Here are some screenshots.

No big deal! This is only a hobby! May I say this looks very good Tommaisey! There is only one minor nitpick: the description comment is now duplicated:

image

Can it be removed?

@tommaisey
tommaisey force-pushed the render-alias-enum-markdown branch from fb231b6 to 01c48a0 Compare March 25, 2026 12:58
@tommaisey

Copy link
Copy Markdown
Contributor Author

@C3pa Good suggestion, I managed to do that. I also cleaned up a little code in a hover/init.lua loop.

Screenshot 2026-03-25 at 12 31 34
Comment thread script/core/hover/init.lua Outdated
local orders = {'function', 'doc.type.function'}
table.sort(defs, function (a, b)
return orders[a] < orders[b]
return (orders[a.type] or (#orders + 1)) < (orders[b.type] or (#orders + 1))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This repeatedly calls #orders for defs with a type that's not in the orders array. Obviously, I don't have any benchmarking data here, but you could cache the orders size outside the callback function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@C3pa done!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@C3pa

C3pa commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Thanks for changing the description format! Looks good.

@tommaisey
tommaisey force-pushed the render-alias-enum-markdown branch from 02a542e to fc2f257 Compare March 30, 2026 01:58
@tommaisey
tommaisey force-pushed the render-alias-enum-markdown branch from fc2f257 to 6951ae4 Compare April 7, 2026 12:29
@tommaisey

Copy link
Copy Markdown
Contributor Author

@sumneko Ready for your review!

@tommaisey
tommaisey force-pushed the render-alias-enum-markdown branch from 6951ae4 to bc8c58c Compare April 20, 2026 14:55
@tommaisey

Copy link
Copy Markdown
Contributor Author

@sumneko Any chance this might get merged?

@tommaisey

Copy link
Copy Markdown
Contributor Author

@sumneko Any thoughts on this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants