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

bug: Extension display the doc comments of structure properties and enum constructors incorrectly #1168

Open
FlammeShadow opened this issue Oct 26, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@FlammeShadow
Copy link
Contributor

FlammeShadow commented Oct 26, 2024

struct A {
  /// doc comment 1
  a : String
}

enum B {
  /// doc comment 2
  C
}

enum D {
  E
}

When focusing on the a, the extension will show only the attribute itself. But focusing on B and C will show doc comment 1. Focusing on E will show doc comment 2. As the image below:

image

If there is any toplevel doc comment in the leading of A, just like:

/// doc comment A
struct A {
  /// doc comment 1
  a : String
}

Focusing on a will show doc comment A. Is this behavior by design?

I use the newst MoonBit Language Extension Nightly and the following toolchain version:

moon 0.1.20241021 (9d3a2d5 2024-10-21) ~\.moon\bin\moon.exe
moonc v0.1.20241021+e6d54baa1 ~\.moon\bin\moonc.exe
moonrun 0.1.20241021 (9d3a2d5 2024-10-21) ~\.moon\bin\moonrun.exe
@Yoorkin
Copy link
Collaborator

Yoorkin commented Oct 30, 2024

Thanks for your feedback, it's a bug. The doc comment is designed to be used at the top level (leading position of structures like enum and struct), so /// ... inside the struct A should be ignored.

@Yoorkin Yoorkin added the bug Something isn't working label Oct 30, 2024
@FlammeShadow
Copy link
Contributor Author

Is there any plan to show comments for properties and constructors?

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

No branches or pull requests

2 participants