Skip to content

Commit 06f5219

Browse files
committed
Remove the ctags functionality
1 parent b1dfac1 commit 06f5219

File tree

1 file changed

+0
-91
lines changed

1 file changed

+0
-91
lines changed

lib/syntax_tree/cli.rb

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -159,92 +159,6 @@ def failure
159159
end
160160
end
161161

162-
# An action of the CLI that generates ctags for the given source.
163-
class CTags < Action
164-
attr_reader :entries
165-
166-
def initialize(options)
167-
super
168-
@entries = []
169-
end
170-
171-
def run(item)
172-
lines = item.source.lines(chomp: true)
173-
174-
SyntaxTree
175-
.index(item.source)
176-
.each do |entry|
177-
line = lines[entry.location.line - 1]
178-
pattern = "/^#{line.gsub("\\", "\\\\\\\\").gsub("/", "\\/")}$/;\""
179-
180-
entries << case entry
181-
when SyntaxTree::Index::ModuleDefinition
182-
parts = [entry.name, item.filepath, pattern, "m"]
183-
184-
if entry.nesting != [[entry.name]]
185-
parts << "class:#{entry.nesting.flatten.tap(&:pop).join(".")}"
186-
end
187-
188-
parts.join("\t")
189-
when SyntaxTree::Index::ClassDefinition
190-
parts = [entry.name, item.filepath, pattern, "c"]
191-
192-
if entry.nesting != [[entry.name]]
193-
parts << "class:#{entry.nesting.flatten.tap(&:pop).join(".")}"
194-
end
195-
196-
unless entry.superclass.empty?
197-
inherits = entry.superclass.join(".").delete_prefix(".")
198-
parts << "inherits:#{inherits}"
199-
end
200-
201-
parts.join("\t")
202-
when SyntaxTree::Index::MethodDefinition
203-
parts = [entry.name, item.filepath, pattern, "f"]
204-
205-
unless entry.nesting.empty?
206-
parts << "class:#{entry.nesting.flatten.join(".")}"
207-
end
208-
209-
parts.join("\t")
210-
when SyntaxTree::Index::SingletonMethodDefinition
211-
parts = [entry.name, item.filepath, pattern, "F"]
212-
213-
unless entry.nesting.empty?
214-
parts << "class:#{entry.nesting.flatten.join(".")}"
215-
end
216-
217-
parts.join("\t")
218-
when SyntaxTree::Index::AliasMethodDefinition
219-
parts = [entry.name, item.filepath, pattern, "a"]
220-
221-
unless entry.nesting.empty?
222-
parts << "class:#{entry.nesting.flatten.join(".")}"
223-
end
224-
225-
parts.join("\t")
226-
when SyntaxTree::Index::ConstantDefinition
227-
parts = [entry.name, item.filepath, pattern, "C"]
228-
229-
unless entry.nesting.empty?
230-
parts << "class:#{entry.nesting.flatten.join(".")}"
231-
end
232-
233-
parts.join("\t")
234-
end
235-
end
236-
end
237-
238-
def success
239-
puts(<<~HEADER)
240-
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
241-
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
242-
HEADER
243-
244-
entries.sort.each { |entry| puts(entry) }
245-
end
246-
end
247-
248162
# An action of the CLI that formats the source twice to check if the first
249163
# format is not idempotent.
250164
class Debug < Action
@@ -418,9 +332,6 @@ def run(item)
418332
#{Color.bold("stree check [--plugins=...] [--print-width=NUMBER] [-e SCRIPT] FILE")}
419333
Check that the given files are formatted as syntax tree would format them
420334
421-
#{Color.bold("stree ctags [-e SCRIPT] FILE")}
422-
Print out a ctags-compatible index of the given files
423-
424335
#{Color.bold("stree debug [--plugins=...] [--print-width=NUMBER] [-e SCRIPT] FILE")}
425336
Check that the given files can be formatted idempotently
426337
@@ -627,8 +538,6 @@ def run(argv)
627538
AST.new(options)
628539
when "c", "check"
629540
Check.new(options)
630-
when "ctags"
631-
CTags.new(options)
632541
when "debug"
633542
Debug.new(options)
634543
when "doc"

0 commit comments

Comments
 (0)