(ns refactor-nrepl.find-unbound
  (:require [clojure.set :as set]
            [clojure.tools.analyzer.ast :refer [nodes]]
            [refactor-nrepl
             [analyzer :refer [ns-ast]]
             [util :refer :all]]))

(defn find-unbound-vars [{:keys [file line column]}]
  {:pre [(number? line)
         (number? column)
         (not-empty file)]}
  (throw-unless-clj-file file)
  (let [content (slurp file)
        ast (ns-ast content)
        sexp (sexp-at-point content line column)
        selected-sexp-node (->> ast
                                 (top-level-form-index line column)
                                 (nth ast)
                                 nodes
                                 (filter (partial node-at-loc? line column))
                                 (filter (partial node-for-sexp? sexp))
                                 last)]
    (into '() (set/intersection (->> selected-sexp-node :env :locals keys set)
                                (->> selected-sexp-node
                                     nodes
                                     (filter #(= :local (:op %)))
                                     (map :form)
                                     set)))))

(ns refactor-nrepl.find-unbound
  (:require [clojure.set :as set]
            [clojure.tools.analyzer.ast :refer [nodes]]
            [refactor-nrepl
             [analyzer :refer [ns-ast]]
             [util :refer :all]]))

(defn find-unbound-vars [{:keys [file line column]}]
  {:pre [(number? line)
         (number? column)
         (not-empty file)]}
  (throw-unless-clj-file file)
  (let [content (slurp file)
        ast (ns-ast content)
        sexp (get-enclosing-sexp content line column)
        selected-sexp-node (->> ast
                                (top-level-form-index line column)
                                (nth ast)
                                nodes
                                (filter (partial node-at-loc? line column))
                                (filter (partial node-for-sexp? sexp))
                                last)]
    (into '() (set/intersection (->> selected-sexp-node :env :locals keys set)
                                (->> selected-sexp-node
                                     nodes
                                     (filter #(= :local (:op %)))
                                     (map :form)
                                     set)))))

Add missing file from last commit
Add missing file from last commit

grammati/refactor-nrepl,Peeja/refactor-nrepl,Peeja/refactor-nrepl,duncanmortimer/refactor-nrepl,duncanmortimer/refactor-nrepl,clojure-emacs/refactor-nrepl,luxbock/refactor-nrepl,clumsyjedi/refactor-nrepl,msgodf/refactor-nrepl,luxbock/refactor-nrepl,clumsyjedi/refactor-nrepl,grammati/refactor-nrepl,msgodf/refactor-nrepl,clojure-emacs/refactor-nrepl