Add context sensitive completion and locate

This changes completion and locate so that they try to use context to decide in which namespaces to look up definitions.