diff options
author | schneems <[email protected]> | 2023-03-09 14:13:46 -0600 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-04-06 15:45:29 +0900 |
commit | 63ea6b0cf2b7fd27e22dc7b468fe65ee2c79b23a (patch) | |
tree | cd71a5059b23d68e5fcb808499390d21897210af /lib/syntax_suggest/clean_document.rb | |
parent | 2acbcec056f54df9b4d98d4d15b1e9f612ac1432 (diff) |
[ruby/syntax_suggest] Rollback comment indentation behavior
Originally I fixed https://github.com/ruby/syntax_suggest/pull/177 by making the process of comment removal indentation aware. The next commit is the more general fix and means we don't need to carry that additional logic/overhead.
Also: Update syntax via linter
Diffstat (limited to 'lib/syntax_suggest/clean_document.rb')
-rw-r--r-- | lib/syntax_suggest/clean_document.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/syntax_suggest/clean_document.rb b/lib/syntax_suggest/clean_document.rb index 08a465dfb0..2c26061bfc 100644 --- a/lib/syntax_suggest/clean_document.rb +++ b/lib/syntax_suggest/clean_document.rb @@ -155,10 +155,11 @@ module SyntaxSuggest # ).to eq(2) # def clean_sweep(source:) + # Match comments, but not HEREDOC strings with #{variable} interpolation + # https://rubular.com/r/HPwtW9OYxKUHXQ source.lines.map do |line| - if line.match?(/^\s*#([^{].*)?$/) # https://rubular.com/r/LLE10D8HKMkJvs - whitespace = /^(?<whitespace>\s*)#([^{].*)?$/.match(line).named_captures["whitespace"] || "" - whitespace + $/ + if line.match?(/^\s*#([^{].*|)$/) + $/ else line end |