jazzy icon indicating copy to clipboard operation
jazzy copied to clipboard

Autolink member properties and methods in class documentation

Open reitzig opened this issue 8 years ago • 2 comments

For code like this:

/**
	Use `bar(...)`!
*/
class Foo {
	func bar() {}

	/**
		- Seealso: `bar(...)`
	*/
	fun spa() {}
}

bar will be autolinked in the documentation of spa, but not that of Foo.

reitzig avatar Jul 27 '17 14:07 reitzig

In Foo's comment, `bar(...)` refers to the function named bar at the same scope. To refer to the method needs Foo.bar(...).

I can imagine searching both scopes but I don't think it's a good idea because of the ambiguity. I can see the usability of not repeating Foo though. An enhancement might be to permit a leading . in autolinked identifiers to mean "within this declaration's scope". And I guess not render the ..

johnfairh avatar Jul 28 '17 10:07 johnfairh

Oh, I see. For me, intuitively, the documentation of the class is at class scope. Similar to how method properties are in-scope in the method documentation (but not at the same scope as the method).

Leading dots would read weirdly in source because that syntax is associated with enum instances.

reitzig avatar Jul 28 '17 11:07 reitzig