From 411a48fe1e5481719c15521a5673841b1677dfc8 Mon Sep 17 00:00:00 2001 From: Jon Doane Date: Tue, 24 Jul 2018 12:58:36 -0400 Subject: [PATCH 1/6] Added highlighting for all loaded and non-aliased namespaces so full names continue to be highlighted. --- autoload/vim_clojure_highlight.clj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/autoload/vim_clojure_highlight.clj b/autoload/vim_clojure_highlight.clj index 384df5f..df425dd 100644 --- a/autoload/vim_clojure_highlight.clj +++ b/autoload/vim_clojure_highlight.clj @@ -67,6 +67,14 @@ (ns-publics alias-ns))) (ns-aliases ns))) +(defn all-ns-refers [] + (mapcat + (fn [current-ns] + (mapv + #(vector (symbol (str current-ns \/ (first %))) (peek %)) + (ns-publics current-ns))) + (map #(symbol (str %)) (all-ns)))) + (defn var-type [v] (let [f @v m (meta v)] (cond (clojure-core? v) (core-symbol->syntax-group (:name m)) @@ -87,6 +95,7 @@ (defn ns-syntax-command [ns & opts] (let [{:keys [local-vars] :or {local-vars true}} (apply hash-map opts) dict (syntax-keyword-dictionary (concat (ns-refers ns) + (all-ns-refers) (aliased-refers ns) (when local-vars (ns-publics ns))))] (str "let b:clojure_syntax_without_core_keywords = 1 | let b:clojure_syntax_keywords = {" dict "}"))) From a2686bab82266dcc736f9e93395bf65ca27407e4 Mon Sep 17 00:00:00 2001 From: Jon Doane Date: Mon, 1 Jul 2019 09:44:13 -0400 Subject: [PATCH 2/6] Updated session check to play nice with latest version of vim-fireplace. --- autoload/vim_clojure_highlight.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/vim_clojure_highlight.vim b/autoload/vim_clojure_highlight.vim index 95df568..48a3614 100644 --- a/autoload/vim_clojure_highlight.vim +++ b/autoload/vim_clojure_highlight.vim @@ -1,7 +1,8 @@ " vim-clojure-highlight function! s:session_exists() - return exists('g:fireplace_nrepl_sessions') && len(g:fireplace_nrepl_sessions) + let client = fireplace#client() + return has_key(client, 'transport') endfunction function! s:require() From aad35c99749c4482a76b09c0fe6008d1cc1d48c7 Mon Sep 17 00:00:00 2001 From: Jon Doane Date: Mon, 1 Jul 2019 09:46:25 -0400 Subject: [PATCH 3/6] Made another update to continue to support older versions of vim-fireplace. --- autoload/vim_clojure_highlight.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/vim_clojure_highlight.vim b/autoload/vim_clojure_highlight.vim index 48a3614..beabf22 100644 --- a/autoload/vim_clojure_highlight.vim +++ b/autoload/vim_clojure_highlight.vim @@ -1,6 +1,10 @@ " vim-clojure-highlight function! s:session_exists() + if exists('g:fireplace_nrepl_sessions') && len(g:fireplace_nrepl_sessions) + return 1 + endif + " Fall through in case we're using a newer version of fireplace. let client = fireplace#client() return has_key(client, 'transport') endfunction From 14c418a02a503c205384884f4bab915ff8e35610 Mon Sep 17 00:00:00 2001 From: Jon Doane Date: Mon, 1 Jul 2019 09:50:02 -0400 Subject: [PATCH 4/6] Final addition to make session check backwards compatible. --- autoload/vim_clojure_highlight.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/vim_clojure_highlight.vim b/autoload/vim_clojure_highlight.vim index beabf22..9c9a8e5 100644 --- a/autoload/vim_clojure_highlight.vim +++ b/autoload/vim_clojure_highlight.vim @@ -5,8 +5,12 @@ function! s:session_exists() return 1 endif " Fall through in case we're using a newer version of fireplace. - let client = fireplace#client() - return has_key(client, 'transport') + try + let client = fireplace#client() + return has_key(client, 'transport') + catch /./ + endtry + return 0 endfunction function! s:require() From 865010e0a94212a146f4de524ac9b06b8a55320d Mon Sep 17 00:00:00 2001 From: Jon Doane Date: Tue, 2 Jul 2019 12:56:02 -0400 Subject: [PATCH 5/6] Switch fireplace detection to be more sane. --- autoload/vim_clojure_highlight.vim | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/autoload/vim_clojure_highlight.vim b/autoload/vim_clojure_highlight.vim index 9c9a8e5..3492758 100644 --- a/autoload/vim_clojure_highlight.vim +++ b/autoload/vim_clojure_highlight.vim @@ -1,13 +1,8 @@ " vim-clojure-highlight function! s:session_exists() - if exists('g:fireplace_nrepl_sessions') && len(g:fireplace_nrepl_sessions) - return 1 - endif - " Fall through in case we're using a newer version of fireplace. try - let client = fireplace#client() - return has_key(client, 'transport') + return fireplace#op_available('eval') catch /./ endtry return 0 From a922eb8d29239feea692078402076413ab083562 Mon Sep 17 00:00:00 2001 From: Jon Doane Date: Sat, 30 Nov 2019 17:37:52 -0500 Subject: [PATCH 6/6] Changed the detection of existance of the `vim-clojure-highlight` namespace to work with latest version of fireplace. --- autoload/vim_clojure_highlight.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/vim_clojure_highlight.vim b/autoload/vim_clojure_highlight.vim index 3492758..0a8e537 100644 --- a/autoload/vim_clojure_highlight.vim +++ b/autoload/vim_clojure_highlight.vim @@ -9,7 +9,8 @@ function! s:session_exists() endfunction function! s:require() - if fireplace#evalparse("(find-ns 'vim-clojure-highlight)") ==# '' + "echo(fireplace#evalparse("(find-ns 'vim-clojure-highlight)") != 'vim-clojure-highlight') + if fireplace#evalparse("(find-ns 'vim-clojure-highlight)") != 'vim-clojure-highlight' let buf = join(readfile(globpath(&runtimepath, 'autoload/vim_clojure_highlight.clj')), "\n") call fireplace#session_eval('(do ' . buf . ')') endif