lib/rsense/server/code.rb in rsense-server-0.5.0 vs lib/rsense/server/code.rb in rsense-server-0.5.2
- old
+ new
@@ -12,10 +12,13 @@
def inject_inference_marker(location)
row = location["row"] - 1
column = location["column"] - 1
lines = @lines.clone
line = lines[row]
+ return lines.join("\n") unless line && line.length >= column - 1 && column > 1
if line.slice(column - 1).end_with?(".")
+ line.insert(column, TYPE_INFERENCE_METHOD_NAME)
+ elsif line.slice(column - 2..column - 1).end_with?("::")
line.insert(column, TYPE_INFERENCE_METHOD_NAME)
else
line.insert(column, ".#{TYPE_INFERENCE_METHOD_NAME}")
end
lines.join("\n")