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

Correctly emit return and params docs #93

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@ public String visitLiteral(LiteralTree node, Element element) {

@Override
public String visitText(TextTree node, Element element) {
return "" + node.getBody();
return node.getBody();
}

@Override
public String visitReturn(ReturnTree node, Element element) {
return "@return "
+ node.getDescription().stream()
.map(docTree -> docTree.accept(this, element))
.collect(Collectors.joining());
}

@Override
public String visitParam(ParamTree node, Element element) {
return (node.isTypeParameter() ? "@typeParam " : "@param ")
+ node.getName()
+ " - "
+ node.getDescription().stream()
.map(docTree -> docTree.accept(this, element))
.collect(Collectors.joining());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.vertispan.tsdefs.tests.tsdocs.doclet.links.methods.nested.JsTypeD;
import com.vertispan.tsdefs.tests.tsdocs.doclet.links.methods.nested.JsTypeE;
import com.vertispan.tsdefs.tests.tsdocs.doclet.links.methods.nested.JsTypeF;
import elemental2.promise.Promise;
import jsinterop.annotations.JsType;

/**
Expand Down Expand Up @@ -64,4 +65,9 @@ public String doSomethingA() {
}

public void doSomethingA2() {}

/** @return {@link Promise} of {@link JsTypeC} */
public Promise<JsTypeC> getTypeC() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright © 2023 Vertispan
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.vertispan.tsdefs.tests.tsdocs.doclet.links.types;

import elemental2.promise.Promise;
import jsinterop.annotations.JsType;

/**
* Represents a class that demonstrates the use of parametrized types.
*
* @param <T> the type of parameter this class operates on
*/
@JsType
public class ParametrizedTypes<T> {

/**
* Retrieves a Promise containing the provided parameter.
*
* @param param1 a {@link Promise} of type T
* @param param2 an additional string parameter
* @return a {@link Promise} containing the value of type T
*/
public Promise<T> getParameter(Promise<T> param1, String param2) {
// Implementation here
return null;
}
}
Loading