Skip to content

Commit

Permalink
Render member extensions correctly (#3374)
Browse files Browse the repository at this point in the history
* Add a lot of tests for extensions rendering in different cases
* Add documentation for unclear things
  • Loading branch information
whyoleg authored Dec 27, 2023
1 parent cefa907 commit 2b1a366
Show file tree
Hide file tree
Showing 4 changed files with 955 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,30 @@ public class SimpleAttr(
}

public enum class BasicTabbedContentType : TabbedContentType {
TYPE, CONSTRUCTOR, FUNCTION, PROPERTY, ENTRY, EXTENSION_PROPERTY, EXTENSION_FUNCTION
TYPE, CONSTRUCTOR,

// property/function here means a different things depending on parent:
// - if parent=package - describes just `top-level` property/function without receiver
// - if parent=classlike - describes `member` property/function,
// it could have receiver (becoming member extension property/function) or not (ordinary member property/function)
// for examples look at docs for `EXTENSION_PROPERTY`, `EXTENSION_FUNCTION`
FUNCTION, PROPERTY,

ENTRY,

// property/function here means a different things depending on parent,
// and not just `an extension property/function`:
// example 1: `fun Foo.bar()` - top-level extension function
// - on a page describing `Foo` class `bar` will have type=`EXTENSION_FUNCTION`
// - on a page describing package declarations `bar` will have type=`EXTENSION_FUNCTION`
// example 2: `object Namespace { fun Foo.bar() }` - member extension function
// - on a page describing `Foo` class `bar` will have type=`EXTENSION_FUNCTION`
// - on a page describing `Namespace` object `bar` will have type=`FUNCTION`
//
// These types are needed to separate member functions and extension function on classlike pages.
// The same split rules are also used
// when grouping functions/properties with the same name on pages for classlike and package
EXTENSION_PROPERTY, EXTENSION_FUNCTION
}

/**
Expand Down
2 changes: 0 additions & 2 deletions dokka-subprojects/plugin-base/api/plugin-base.api
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,6 @@ public class org/jetbrains/dokka/base/translators/documentables/DefaultPageCreat
public static synthetic fun contentForScope$default (Lorg/jetbrains/dokka/base/translators/documentables/DefaultPageCreator;Lorg/jetbrains/dokka/model/WithScope;Lorg/jetbrains/dokka/links/DRI;Ljava/util/Set;Ljava/util/List;ILjava/lang/Object;)Lorg/jetbrains/dokka/pages/ContentGroup;
protected fun contentForScopes (Ljava/util/List;Ljava/util/Set;Ljava/util/List;)Lorg/jetbrains/dokka/pages/ContentGroup;
public static synthetic fun contentForScopes$default (Lorg/jetbrains/dokka/base/translators/documentables/DefaultPageCreator;Ljava/util/List;Ljava/util/Set;Ljava/util/List;ILjava/lang/Object;)Lorg/jetbrains/dokka/pages/ContentGroup;
protected fun divergentBlock (Lorg/jetbrains/dokka/base/translators/documentables/PageContentBuilder$DocumentableContentBuilder;Ljava/lang/String;Ljava/util/Collection;Lorg/jetbrains/dokka/pages/ContentKind;Lorg/jetbrains/dokka/model/properties/PropertyContainer;)V
public static synthetic fun divergentBlock$default (Lorg/jetbrains/dokka/base/translators/documentables/DefaultPageCreator;Lorg/jetbrains/dokka/base/translators/documentables/PageContentBuilder$DocumentableContentBuilder;Ljava/lang/String;Ljava/util/Collection;Lorg/jetbrains/dokka/pages/ContentKind;Lorg/jetbrains/dokka/model/properties/PropertyContainer;ILjava/lang/Object;)V
protected fun getContentBuilder ()Lorg/jetbrains/dokka/base/translators/documentables/PageContentBuilder;
public final fun getCustomTagContentProviders ()Ljava/util/List;
public final fun getDocumentableAnalyzer ()Lorg/jetbrains/dokka/analysis/kotlin/internal/DocumentableSourceLanguageParser;
Expand Down
Loading

0 comments on commit 2b1a366

Please sign in to comment.