From 2331128c24200bc47311774654196485d005537c Mon Sep 17 00:00:00 2001 From: Stafford Brunk Date: Sat, 6 Jan 2018 22:43:56 -0700 Subject: [PATCH] Fix getEntry regex to handle additional cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It will not handle default arguments being a hash (eg def foo(params = {})) as well as other text coming before the entry (eg foo = if …) --- src/ruby.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ruby.ts b/src/ruby.ts index 70d49fdab..dfee94276 100644 --- a/src/ruby.ts +++ b/src/ruby.ts @@ -52,8 +52,7 @@ function registerHighlightProvider(ctx: ExtensionContext) { } const getEntry = function(line) { - //only lines that start with the entry - let match = line.text.match(/^(\s*)(begin|class|def|for|if|module|unless|until|case|while)\b[^\{;]*$/); + let match = line.text.match(/^(.*\b)(begin|class|def|for|if|module|unless|until|case|while)\b[^;]*$/); if (match) { return new vscode.Range(line.lineNumber, match[1].length, line.lineNumber, match[1].length + match[2].length); } else {