Skip to content

Commit 480f095

Browse files
committed
Allow CLI flags for lsp
1 parent ac16838 commit 480f095

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/syntax_tree/cli.rb

+15-15
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def run(item)
218218
#{Color.bold("stree help")}
219219
Display this help message
220220
221-
#{Color.bold("stree lsp")}
221+
#{Color.bold("stree lsp [OPTIONS]")}
222222
Run syntax tree in language server mode
223223
224224
#{Color.bold("stree version")}
@@ -239,6 +239,20 @@ class << self
239239
def run(argv)
240240
name, *arguments = argv
241241

242+
# If there are any plugins specified on the command line, then load them
243+
# by requiring them here. We do this by transforming something like
244+
#
245+
# stree format --plugins=haml template.haml
246+
#
247+
# into
248+
#
249+
# require "syntax_tree/haml"
250+
#
251+
if arguments.first&.start_with?("--plugins=")
252+
plugins = arguments.shift[/^--plugins=(.*)$/, 1]
253+
plugins.split(",").each { |plugin| require "syntax_tree/#{plugin}" }
254+
end
255+
242256
case name
243257
when "help"
244258
puts HELP
@@ -282,20 +296,6 @@ def run(argv)
282296
return 1
283297
end
284298

285-
# If there are any plugins specified on the command line, then load them
286-
# by requiring them here. We do this by transforming something like
287-
#
288-
# stree format --plugins=haml template.haml
289-
#
290-
# into
291-
#
292-
# require "syntax_tree/haml"
293-
#
294-
if arguments.first&.start_with?("--plugins=")
295-
plugins = arguments.shift[/^--plugins=(.*)$/, 1]
296-
plugins.split(",").each { |plugin| require "syntax_tree/#{plugin}" }
297-
end
298-
299299
# We're going to build up a queue of items to process.
300300
queue = Queue.new
301301

0 commit comments

Comments
 (0)