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

Comments incorrectly appended to hovered functions #310

Open
ArchLand64 opened this issue Mar 5, 2023 · 3 comments · May be fixed by #391
Open

Comments incorrectly appended to hovered functions #310

ArchLand64 opened this issue Mar 5, 2023 · 3 comments · May be fixed by #391
Labels
bug Something isn't working

Comments

@ArchLand64
Copy link

ArchLand64 commented Mar 5, 2023

A common pattern that I do in my code is use large comments to organize all the different types of functions that I write. My problem is that those large comments are incorrectly appended to hovered function documentation, as boxed in red below.
image

I expect only the comment directly above the function to be highlighted. In the case of the above picture, I only want to see "Does physics simulation".

Here is the example code that has the problem:

--[[
==========================Math Functions==========================
]]

--[[
	Helps do math for physics
]]
local function Add(a: number, b: number): number
	return a + b
end

--[[
==========================Physics Functions==========================
]]

--[[
	Does physics simulation
]]
local function _Simulate(a: number, b: number): number
	return Add(a, b) * Add(a, b)
end
@JohnnyMorganz
Copy link
Owner

This is a little bit more difficult to look out for since we don't track whitespace. I would recommend against doing this, but I'll see what we can do

@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Jun 15, 2023
@JohnnyMorganz JohnnyMorganz linked a pull request Jun 15, 2023 that will close this issue
@LastTalon
Copy link

LastTalon commented Sep 21, 2023

To be clear, this is an issue when using doc comments as well. Often floating doc comments will exist such as the following example and it happens there, too. When it happens in this case it's actually worse because it actually displays confusing documentation.

image

image

I think the way to address this is to only use the ones directly attached, so we'll likely have to check the whitespace in this particular case since it's semantic.

@mxruben
Copy link

mxruben commented Jun 21, 2024

I think this might be an issue specifically with multiline comments. I've noticed that the contents of multiline comments get appended to the doc comment below them. If there isn't a doc comment it just becomes one. It seems like multiline comments are just always treated as doc comments?
Screenshot from 2024-06-21 12-24-08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants