private TypeScriptDataAssociation GetAssociatedData(ISourceFile sourceFile)
        {
            TypeScriptDataAssociation result = null;

            if (!dataAssociations.TryGetValue(sourceFile, out result))
            {
                throw new Exception("Tried to parse file that has not been registered with the language service.");
            }

            return(result);
        }
        public void RegisterSourceFile(IIntellisenseControl intellisenseControl,
                                       ICompletionAssistant completionAssistant, TextEditor.TextEditor editor, ISourceFile file,
                                       TextDocument textDocument)
        {
            _tsContext = _tsContext ?? ((TypeScriptProject)file.Project).TypeScriptContext;
            _tsContext.OpenFile(file.FilePath, File.ReadAllText(file.FilePath));

            TypeScriptDataAssociation association = null;

            if (dataAssociations.TryGetValue(file, out association))
            {
                throw new InvalidOperationException("Source file already registered with language service.");
            }

            association = new TypeScriptDataAssociation(textDocument);
            dataAssociations.Add(file, association);
        }