Closed
Description
When highlighting ruby code the matching is not correctly matching on 'if defined'
for example:
if defined?(key)
Instead of matching on the 2 keywords IF and DEFINED it instead matches on IF and DEF as keywords then matched INED as a title. The downside to this is the word defined is now in 2 different colours.
I think it is related to the use if def when defining a function in ruby and so it is matching def from the word defined and thinks you have a function called ined.
I am using version 10.5.0 of highlight.
Sample Code:
I am using sunburst.css (although this happens in others and I don't think the css is the issue)
#!/usr/bin/env ruby
require 'rubygems'
require 'gems'
require 'terminal-table'
if defined?(key)
Gems.configure do |config|
config.key = key
end
else
puts 'Using default gem creds'
end
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
joshgoebel commentedon Feb 27, 2021
Confirm. Pretty sure our function detection should probably be
def\s+
notdef\s*
.[-]Ruby highlighting is miss matching 'if defined'[/-][+]bug(ruby) 'if defined?' is mis-highlighted as a def method[/+]fix(ruby) `defined?` triggers def rule incorrectly