LuaLS / LuaLS/lua-language-server

Lines in annotations don't appear in order as written

Open
#2,389 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

Hey!

Descriptions, comment lines don't appear in order as written under any specified @param and @return description, they are displayed in bulk at the bottom. Also, the main function6object descriptions from the top line are also displayed below param and return value descriptions.

I've been using an older version of the extension (2.6.8), I updated it to see if issues I had with newer versions had been resolved since. Mostly, yes they have been and it works much faster than before so I'd like to stay - but the way I've been annotating stuff, it is a really annoying yet simple issue.

Here's an example (the detailed annotations of a function that gets and returns color values, unpacking them from the table provided):

---Returns the position values used by [Region:SetPoint(...)](https://wowpedia.fandom.com/wiki/API_ScriptRegionResizing_SetPoint) from a position table used by WidgetTools
---@param t? table Table containing parameters to call [Region:SetPoint(...)](https://wowpedia.fandom.com/wiki/API_ScriptRegionResizing_SetPoint) with
--- - **anchor**? [AnchorPoint](https://wowpedia.fandom.com/wiki/Anchors) *optional* — ***Default:*** "TOPLEFT"
--- - **relativeTo**? [Frame](https://wowpedia.fandom.com/wiki/API_CreateFrame#Frame_types)|string *optional* ― Frame reference or name | ***Default:*** UIParent if **t.relativePoint** ~= nil
--- - **relativePoint**? [AnchorPoint](https://wowpedia.fandom.com/wiki/Anchors) *optional* — ***Default:*** **t.anchor** if **t.relativeTo** ~= nil
--- - **offset**? table *optional*
--- 	- **x**? number *optional* — ***Default:*** 0
--- 	- **y**? number *optional* — ***Default:*** 0
---@return AnchorPoint anchor ***Default:*** "TOPLEFT"
--- - ***Note:*** Default to "TOPLEFT" when an invalid input is provided.
---@return Frame|nil? relativeTo ***Default:*** UIParent if **t.relativePoint** ~= nil
---@return AnchorPoint|nil? relativePoint ***Default:*** **t.anchor** if **t.relativeTo** ~= nil
---@return number? offsetX ***Default:*** 0
---@return number? offsetY ***Default:*** 0

I expect the entire text to appear as such (as it used to with the old extension version I've been using) when mousing over the function:
image

However, now it appears like so:
image

If it is the intended way of displaying annotations, that's fine - I assume some people prefer it this way but I do prefer and expect it to be displayed as it used to be, all lines rendered in order as written. If this is the case, please add a setting so everyone can specify the annotation rendering behavior to meet their preference.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hover output with the supplied Lua annotation example and compare it with the expected source order. Trace the annotation hover rendering path, then determine whether preserving order or adding a rendering setting fits the existing behavior. Done means the displayed lines match the requested ordering, with any new setting documented and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.