Skip to content

Add docstrings to matcher-combinators.test declarations#236

Open
philomates wants to merge 1 commit intomasterfrom
clojure-test-docstrings
Open

Add docstrings to matcher-combinators.test declarations#236
philomates wants to merge 1 commit intomasterfrom
clojure-test-docstrings

Conversation

@philomates
Copy link
Copy Markdown
Collaborator

@philomates philomates commented Apr 13, 2026

I had to change the declare forms in matcher-combinators.test to defns so that the docstring would be picked up by LSP. Just adding :doc meta to the declare, like the following, doesn't seem to get picked up by the clojure LSP as far as I can tell

(require '[matcher-combinators.test :refer [match? thrown-match?]])
(declare ^{:arglists '([matcher actual]) :doc "some docstring"} match?)
(:doc (meta #'match?))

@philomates philomates force-pushed the clojure-test-docstrings branch 2 times, most recently from 33d00a3 to 1fef66d Compare April 13, 2026 09:41
Comment on lines +32 to +36
(defn match-with?
"DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead."
[type->matcher matcher actual]
(throw (#?(:cljs js/Error. :clj AssertionError.)
"Should only be invoked within a `clojure.test/is` form")))
Copy link
Copy Markdown

@teodorlu teodorlu Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be helpful for users to include :deprecated "deprecated-version" metadata:

Suggested change
(defn match-with?
"DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead."
[type->matcher matcher actual]
(throw (#?(:cljs js/Error. :clj AssertionError.)
"Should only be invoked within a `clojure.test/is` form")))
(defn match-with?
"DEPRECATED: Use (match? (matcher-combinators.matchers/match-with <type->matcher> <expected>) <actual>) instead."
{:deprecated "3.0.0"}
[type->matcher matcher actual]
(throw (#?(:cljs js/Error. :clj AssertionError.)
"Should only be invoked within a `clojure.test/is` form")))

This will show up in most editors that rely on clojure-lsp. My Emacs the referenced var with strikethough, and deprecated version below:

Image

@NoahTheDuke
Copy link
Copy Markdown

Looks like this is a redo of my PR #207, which i couldn't ever get to work. I'll close that one if you can get the test suite to pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants