Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.foundation.editing.structural

Thin Clojure adapter over the pack's Java structural-edit engine (dev.kreuzberg.treesitterlanguagepack.StructuralApi). All the work — locate the definition by name from the tree-sitter outline, splice its line span, and re-parse to refuse syntax-breaking edits — lives in Java so it is language-neutral, reusable from any JVM consumer, and native-image clean. This namespace only maps vis op keywords onto the Java API.

Thin Clojure adapter over the pack's Java structural-edit engine
(`dev.kreuzberg.treesitterlanguagepack.StructuralApi`). All the work —
locate the definition by name from the tree-sitter outline, splice its line
span, and re-parse to refuse syntax-breaking edits — lives in Java so it is
language-neutral, reusable from any JVM consumer, and native-image clean.
This namespace only maps vis op keywords onto the Java API.
raw docstring

edit-sourceclj

(edit-source path source {:keys [op target kind code match anchor]})

Return the new file content for a structural edit, or throw with an actionable message (StructuralApi$EditException on missing/ambiguous target, no match, or a syntax-breaking result). op ∈ #{:replace :insert-before :insert-after :append :replace-doc :add-doc :replace-node :rename :move-before :move-after}. :replace-node replaces the unique sub-expression equal to :match (optionally scoped to :target); :rename renames identifier :target to :code; :append ignores :target; :move-before/:move-after relocate the node named :target next to the node named :anchor.

Return the new file content for a structural edit, or throw with an
actionable message (StructuralApi$EditException on missing/ambiguous target,
no match, or a syntax-breaking result). `op` ∈ #{:replace :insert-before
:insert-after :append :replace-doc :add-doc :replace-node :rename
:move-before :move-after}.
`:replace-node` replaces the unique sub-expression equal to `:match`
(optionally scoped to `:target`); `:rename` renames identifier `:target` to
`:code`; `:append` ignores `:target`; `:move-before`/`:move-after` relocate
the node named `:target` next to the node named `:anchor`.
sourceraw docstring

occurrencesclj

(occurrences path source name)

Every occurrence of identifier name in path — the DEFINITION occurrences ENRICHED — as ONE list (empty if none / unknown language):

{:anchor} ; a plain use {:anchor :is-definition true :kind :visibility :signature ; a DEFINITION :doc :end-anchor} ; span = :anchor..:end-anchor

Every entry's SOLE position is its patch-ready lineno:hash :anchor (the lineno lives in the anchor — no redundant :line/:column/byte fields). A use is just that anchor; a definition also carries its kind / visibility (public| private) / signature / doc-gist and an :end-anchor (:anchor..:end-anchor is the whole def, patchable in one edit). Syntactic (tree-sitter identifier boundaries, no scope resolution — so N same-named definitions are each marked).

Definition detection: the FIRST occurrence inside each definition's :anchor..:end-anchor line span IS its declaration name (findReferences returns hits in source order), so it survives decorators / attributes above it.

Every occurrence of identifier `name` in `path` — the DEFINITION occurrences
ENRICHED — as ONE list (empty if none / unknown language):

  {:anchor}                                                     ; a plain use
  {:anchor :is-definition true :kind :visibility :signature     ; a DEFINITION
   :doc :end-anchor}                                            ;   span = :anchor..:end-anchor

Every entry's SOLE position is its patch-ready `lineno:hash` `:anchor` (the
lineno lives in the anchor — no redundant :line/:column/byte fields). A use is
just that anchor; a definition also carries its kind / visibility (public|
private) / signature / doc-gist and an `:end-anchor` (`:anchor`..`:end-anchor`
is the whole def, patchable in one edit). Syntactic (tree-sitter identifier
boundaries, no scope resolution — so N same-named definitions are each marked).

Definition detection: the FIRST occurrence inside each definition's
`:anchor`..`:end-anchor` line span IS its declaration name (findReferences
returns hits in source order), so it survives decorators / attributes above it.
sourceraw docstring

referencesclj

(references path source name)

Occurrences of identifier name in path as [{:line :column :start-byte :end-byte :anchor} …] (empty if none / unknown language). :anchor is the line's <lineno>:<hash> patch anchor, so a hit can be edited directly with patch — same anchors cat / outline emit.

Occurrences of identifier `name` in `path` as
[{:line :column :start-byte :end-byte :anchor} …] (empty if none / unknown
language). `:anchor` is the line's `<lineno>:<hash>` patch anchor, so a hit
can be edited directly with patch — same anchors cat / outline emit.
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