Fix tern addon to check for state lexical in local file state

Please review the following commit and merge it if you think it is relevant.

Thank you!

Regards,
Svetozar Toskov.