is the list and the trigger function code in the same script? (that space between the listname and first [ is a little telling that it isn’t since the IDE didn’t recognise the name as a collection… )
VS2015 has settings to allow weird spacing options. Not sure about earlier versions or other editors, I only noticed it in 2015 while looking for something else.