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

Display deprecated label when @[Deprecated] is used #7653

Merged

Conversation

Projects
None yet
3 participants
@bcardiff
Copy link
Member

commented Apr 8, 2019

Depends on #7652 (marked as draft until merged)

The last commit of the PR adds support of the doc generator tool to understand the @[Deprecated] and emit the same label that is currently emitted when a # DEPRECATED: ... comment is found.

Even before this PR the labels are only emitted for methods. But the implementation will be ready to handle them once other annotations are preserved by the parser/compiler.

Show me a sample (with screenshot)

Given the following code:

module FOO
  # DEPRECATED: Use `Bar` instead1
  @[Deprecated("Use `Bar` instead2", "sdfs")]
  class Foo
    # DEPRECATED: Use `VAL_B` instead1
    @[Deprecated("Use `VAL_B` instead2")]
    VAL_A = 10
    VAL_B = 20

    # DEPRECATED: Use `#bar` instead1
    @[Deprecated("Use `#bar` instead2")]
    def foo
    end

    # DEPRECATED
    @[Deprecated]
    def foo2
    end

    def bar
    end

    # DEPRECATED: Use `#qux` instead1
    @[Deprecated("Use `#qux` instead2")]
    macro baz
    end

    macro qux
    end
  end

  class Bar
  end
end

This is the generated output:

screencapture-file-Users-bcardiff-Projects-crystal-master-docs-FOO-Foo-html-2019-04-08-17_50_00

@bcardiff bcardiff force-pushed the bcardiff:feature/deprecation-docs-tool branch from 14c1722 to 131aab0 Apr 10, 2019

@bcardiff bcardiff marked this pull request as ready for review Apr 10, 2019

@bcardiff bcardiff requested a review from straight-shoota Apr 10, 2019

@straight-shoota
Copy link
Member

left a comment

Injecting annotations into the markdown string looks like a cheap hack.
But should be fine for now.

@bcardiff

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2019

Yes @straight-shoota I agree. It's cheap.

Merging this will mean that the time deprecation does not need to be in the comments 🚀

@RX14

RX14 approved these changes Apr 11, 2019

@bcardiff bcardiff merged commit 9871f43 into crystal-lang:master Apr 11, 2019

5 checks passed

ci/circleci: check_format Your tests passed on CircleCI!
Details
ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@bcardiff bcardiff added this to the 0.28.0 milestone Apr 11, 2019

@bcardiff bcardiff deleted the bcardiff:feature/deprecation-docs-tool branch Apr 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.