Commits

SirAlaran  committed 6288568

Initial support for auto declarations

  • Participants
  • Parent commits 119a91e

Comments (0)

Files changed (1)

 local declarations = {
 	"([%w_]+)%s",
 	"([%w_]+![%w_]+)",
-	"([%w_]+%s*%b[])%s",
-	"([%w_]+%s*!%s*%b())%s",
-	"([%w_]+%s*!%b()%s*%b[])%s",
+	"([%w_]+)%s*%b[]%s",
+	"([%w_]+)%s*!%s*%b()%s",
+	"([%w_]+)%s*!%b()%s*%b[]%s",
 }
 
 local function clearCompletionInfo()
 		if line:find(symbol) then
 			for _, pattern in ipairs(declarations) do
 				local typeName = line:match(pattern..symbol.."%f[%s%p_]")
-				if typeName and typeName ~= "return" then
+				if typeName == "auto" then
+					local autoPattern = "auto%s+"..symbol.."%s*=%s*(%w+)"
+					print(autoPattern)
+					local typeName = line:match(autoPattern)
+					if typeName == "new" then
+						autoPattern = "auto%s+"..symbol.."%s*=%s*new%s+(%w+)"
+						typeName = line:match(autoPattern)
+					end
+					return typeName, lineNumber
+				elseif typeName and typeName ~= "return" then
 					return typeName, lineNumber
 				end
 			end