Task CreateParseTypeScriptFileTask(CodeEditor editor)
        {
            ITextBuffer       fileContent = editor.DocumentAdapter.CreateSnapshot();
            TypeScriptProject project     = TypeScriptService.GetProjectForFile(editor.FileName);

            return(Task
                   .Factory
                   .StartNew(() => ParseTypeScriptFile(editor.FileName, fileContent, project))
                   .ContinueWith(task => UpdateParseInformation(task.Result), TaskScheduler.FromCurrentSynchronizationContext()));
        }
        void FileSaved(object sender, FileNameEventArgs e)
        {
            if (!TypeScriptFileExtensions.IsTypeScriptFileName(e.FileName))
            {
                return;
            }

            TypeScriptProject project = TypeScriptService.GetProjectForFile(e.FileName);

            if (project == null)
            {
                return;
            }

            if (project.CompileOnSave)
            {
                var action = new CompileTypeScriptOnSaveFileAction();
                TypeScriptContext context = TypeScriptService.ContextProvider.GetContext(e.FileName);
                action.Compile(e.FileName, project, context);
            }
        }
예제 #3
0
 public IEnumerable <TypeScriptFile> GetTypeScriptFiles()
 {
     return(GetTypeScriptFileNames()
            .Select(fileName => new TypeScriptFile(fileName, TypeScriptService.GetFileContents(fileName))));
 }
 protected void UpdateFile(TypeScriptContext context, FileName fileName)
 {
     context.UpdateFile(fileName, TypeScriptService.GetFileContents(fileName));
 }
예제 #5
0
 public override void Run()
 {
     TypeScriptService.Initialize();
 }