1- use crate :: tools:: ctags:: { BufferTag , CTAGS_HAS_JSON_FEATURE } ;
1+ use crate :: tools:: ctags:: { BufferTag , CTAGS_BIN } ;
22use rayon:: prelude:: * ;
33use std:: io:: Result ;
4- use std:: ops:: Deref ;
54use std:: path:: Path ;
65use std:: process:: Stdio ;
76use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
@@ -94,7 +93,7 @@ fn find_context_tag(superset_tags: Vec<BufferTag>, at: usize) -> Option<BufferTa
9493///
9594/// NOTE: I don't know why, but this may take forever to complete somehow, making the async runtime blocked.
9695pub async fn current_context_tag_async ( file : & Path , at : usize ) -> Option < BufferTag > {
97- let superset_tags = if * CTAGS_HAS_JSON_FEATURE . deref ( ) {
96+ let superset_tags = if CTAGS_BIN . has_json_feature ( ) {
9897 collect_superset_context_tags_async ( tokio_cmd ( file, true ) , BufferTag :: from_json_line, at)
9998 . await
10099 } else {
@@ -107,7 +106,7 @@ pub async fn current_context_tag_async(file: &Path, at: usize) -> Option<BufferT
107106
108107/// Returns the method/function context associated with line `at`.
109108pub fn current_context_tag ( file : & Path , at : usize ) -> Option < BufferTag > {
110- let superset_tags = if * CTAGS_HAS_JSON_FEATURE . deref ( ) {
109+ let superset_tags = if CTAGS_BIN . has_json_feature ( ) {
111110 collect_superset_context_tags ( subprocess_cmd ( file, true ) , BufferTag :: from_json_line, at)
112111 } else {
113112 collect_superset_context_tags ( subprocess_cmd ( file, false ) , BufferTag :: from_raw_line, at)
@@ -120,7 +119,7 @@ pub fn buffer_tags_lines(
120119 file : impl AsRef < std:: ffi:: OsStr > ,
121120 force_raw : bool ,
122121) -> Result < Vec < String > > {
123- let ( tags, max_name_len) = if * CTAGS_HAS_JSON_FEATURE . deref ( ) && !force_raw {
122+ let ( tags, max_name_len) = if CTAGS_BIN . has_json_feature ( ) && !force_raw {
124123 collect_buffer_tags ( subprocess_cmd ( file, true ) , BufferTag :: from_json_line) ?
125124 } else {
126125 collect_buffer_tags ( subprocess_cmd ( file, false ) , BufferTag :: from_raw_line) ?
@@ -133,7 +132,7 @@ pub fn buffer_tags_lines(
133132}
134133
135134pub fn fetch_buffer_tags ( file : impl AsRef < std:: ffi:: OsStr > ) -> Result < Vec < BufferTag > > {
136- let ( mut tags, _max_name_len) = if * CTAGS_HAS_JSON_FEATURE . deref ( ) {
135+ let ( mut tags, _max_name_len) = if CTAGS_BIN . has_json_feature ( ) {
137136 collect_buffer_tags ( subprocess_cmd ( file, true ) , BufferTag :: from_json_line) ?
138137 } else {
139138 collect_buffer_tags ( subprocess_cmd ( file, false ) , BufferTag :: from_raw_line) ?
@@ -148,7 +147,7 @@ pub fn buffer_tag_items(
148147 file : impl AsRef < std:: ffi:: OsStr > ,
149148 force_raw : bool ,
150149) -> Result < Vec < Arc < dyn ClapItem > > > {
151- let ( tags, max_name_len) = if * CTAGS_HAS_JSON_FEATURE . deref ( ) && !force_raw {
150+ let ( tags, max_name_len) = if CTAGS_BIN . has_json_feature ( ) && !force_raw {
152151 collect_buffer_tags ( subprocess_cmd ( file, true ) , BufferTag :: from_json_line) ?
153152 } else {
154153 collect_buffer_tags ( subprocess_cmd ( file, false ) , BufferTag :: from_raw_line) ?
0 commit comments