-
-
Notifications
You must be signed in to change notification settings - Fork 789
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
Exported package interface returns wrong documentation #3712
Comments
Could you give an example of some code and the documentation it provides please. Thank you |
Actually, a little correction, when Gleam first creates the documentation, it seems that it appends a extra newline to the text, which is later removed on the import gleam/io
/// A person role inside a school
///
pub type SchoolPerson {
Teacher(name: String, subject: String)
Student(name: String)
}
/// A school type
pub type SchoolType {
School(name: String, people: List(SchoolPerson))
University(name: String, people: List(SchoolPerson))
}
pub fn main() {
let teacher = Teacher("Mr Schofield", "Physics")
let student = Student("Koushiar")
io.debug(teacher.name)
io.debug(student.name)
} In the debug code above, I just modified the message to also include the documentation itself, and here is the output:
|
Why is it that the new lines are different each time it is printed? |
See, that's the thing I couldn't work out exactly. What I believe is that the implementation for finding documentation in the |
The newline at the end is correct. UNIX says text lines must end with a newline. |
Upon further inspection, I believe it isn't the |
I'm not sure it matter that much to be honest. Did you uncover some problem caused by it? |
To be fair, just some differences, nothing more. |
Let's close this for now then and reopen when we find it surfacing as a problem. Thank you |
I've been doing the PR at #3669 and I noticed that when Gleam will export the package interface JSON, it returns the documentations with an extra newline. I've then tested on the compiler without my changes and it still behaves like that. You can test this by adding the following prints to debug it:
at the end of the
package_compiler.compile
function and.map(|(name, info)| debug_module(name, info))
right before the.collect()
in thepackage_interface.from_package
function. Also make sure to define the following function in thepackage_interface
module:I believe the problem is with the
Package::attach_doc_and_module_comments" in the
build` module, although I'm not sure.The text was updated successfully, but these errors were encountered: