class SyntaxSuggest::CodeSearch

搜索代码中的语法错误

该算法有三个主要阶段

  1. 清理/格式化输入源

  2. 搜索无效的代码块

  3. 将无效的代码块格式化为有意义的内容

此类处理这部分。

大部分繁重的工作在

- CodeFrontier (Holds information for generating blocks and determining if we can stop searching)
- ParseBlocksFromLine (Creates blocks into the frontier)
- BlockExpand (Expands existing blocks to search more code)

## 语法错误检测

当边界包含语法错误时,我们可以停止搜索

search = CodeSearch.new(<<~EOM)
  def dog
    def lol
  end
EOM

search.call

search.invalid_blocks.map(&:to_s) # =>
# => ["def lol\n"]