weavejester / ns-tracker

Library to keep track of changes to Clojure source files
Eclipse Public License 1.0
114 stars 20 forks source link

doesn't track namespace when ns decl isn't first in file #15

Closed trevor closed 10 years ago

trevor commented 10 years ago

It appears ns-tracker will cease following a namespace when there's non-commented content before the namespace declaration.

works:

;-begin
(ns myproject.core)
(println "hi")
;-end

untracked — (any of the four possibilities when uncommented, for example):

;-begin
1
;;; (println "before ns")
;;; (println "loading" *file*)
;;; :abc
(ns myproject.core)
(println "hi")
;-end
weavejester commented 10 years ago

This is a limitation of the tools.namespace library, which assumes the first form read is the namespace declaration. In practice, it almost always will be, and I haven't heard any reason why it shouldn't be, so this doesn't seem like a huge problem.

trevor commented 10 years ago

Great, thank you for pointing me in the right direction!

http://dev.clojure.org/jira/browse/TNS-17

weavejester commented 10 years ago

TBH I'm not sure it's fixable. There are any number of different ways that you could obscure the namespace a file contains. The only way for tools.namespace to work is to rely on a convention.