Liking cljdoc? Tell your friends :D

still.location

Source code location tracking for snap! calls.

Captures file path, line, and column information from the call site to enable automatic source editing.

Source code location tracking for snap! calls.

Captures file path, line, and column information from the call site to enable
automatic source editing.
raw docstring

file-from-nsclj

(file-from-ns ns-sym)

Convert a namespace to a source file path.

Examples: (file-from-ns 'still.core) => "src/still/core.clj" or "src/still/core.cljc" (file-from-ns 'my.test) => "test/my/test.clj"

Convert a namespace to a source file path.

Examples:
  (file-from-ns 'still.core) => "src/still/core.clj" or "src/still/core.cljc"
  (file-from-ns 'my.test) => "test/my/test.clj"
sourceraw docstring

get-call-siteclj

(get-call-site depth)

Get the call site information from the current stack trace.

Returns a map with:

  • :file - Source file path
  • :line - Line number
  • :column - Column number (if available)
  • :ns - Namespace

The depth parameter controls how far up the stack to look:

  • depth 0: the call to get-call-site itself
  • depth 1: the caller of get-call-site
  • depth 2: the caller's caller, etc.

For snap! calls, we typically want depth 1 or 2.

Get the call site information from the current stack trace.

Returns a map with:
- :file - Source file path
- :line - Line number
- :column - Column number (if available)
- :ns - Namespace

The depth parameter controls how far up the stack to look:
- depth 0: the call to get-call-site itself
- depth 1: the caller of get-call-site
- depth 2: the caller's caller, etc.

For snap! calls, we typically want depth 1 or 2.
sourceraw docstring

location-stringclj

(location-string {:keys [file line column]})

Format a location map as a human-readable string.

Examples: (location-string {:file "test.clj" :line 42}) ;; => "test.clj:42"

(location-string {:file "test.clj" :line 42 :column 10}) ;; => "test.clj:42:10"

Format a location map as a human-readable string.

Examples:
  (location-string {:file "test.clj" :line 42})
  ;; => "test.clj:42"

  (location-string {:file "test.clj" :line 42 :column 10})
  ;; => "test.clj:42:10"
sourceraw docstring

resolve-file-pathclj

(resolve-file-path filename)

Resolve a source file name to an absolute path.

Searches in:

  1. src/ directory
  2. test/ directory
  3. dev/ directory
  4. Current working directory

Returns nil if file cannot be found.

Resolve a source file name to an absolute path.

Searches in:
1. src/ directory
2. test/ directory
3. dev/ directory
4. Current working directory

Returns nil if file cannot be found.
sourceraw docstring

with-locationcljmacro

(with-location expr)

Capture location information at macro expansion time.

Returns a vector [value location-map] where location-map contains:

  • :file - Source file name
  • :line - Line number
  • :absolute-path - Absolute file path (if resolvable)

Example: (with-location (+ 1 2)) ;; => [3 {:file "my_test.clj" :line 42 :absolute-path "/path/to/my_test.clj"}]

Capture location information at macro expansion time.

Returns a vector [value location-map] where location-map contains:
- :file - Source file name
- :line - Line number
- :absolute-path - Absolute file path (if resolvable)

Example:
  (with-location (+ 1 2))
  ;; => [3 {:file "my_test.clj" :line 42 :absolute-path "/path/to/my_test.clj"}]
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close