Ejemplo n.º 1
0
        private SyntaxTree ParseFile(CodeFile codeFile)
        {
            stopwatch.Reset();
            stopwatch.Start();

            var ast = new SyntaxTree();

            try
            {
                var parser = new FortranFileParser();
                codeFile.Contents = VisualStudioIDE.GetCodeFileContents(codeFile);
                ast = parser.ParseFileContents(codeFile.Contents, GetStyleFromExtension(codeFile.FileName));
            }
            catch (Exception e)
            {
                //gulp
                Log.Error(String.Format("Error while parsing {0}", codeFile.FilePath), e);
            }
            finally
            {
                ast.CodeFile = codeFile;
                ast.FileName = codeFile.FilePath;
            }

            stopwatch.Stop();

            double milliseconds = (((double)stopwatch.ElapsedTicks) / Stopwatch.Frequency) * 1000;

            Log.Write(String.Format("Parsing {0} took {1:0.#}ms", codeFile.FilePath, milliseconds));

            return(ast);
        }
Ejemplo n.º 2
0
        public DebugForm(VisualStudioIDE ide, Version version, FortranCodeNavCore codeNav)
        {
            CodeNav = codeNav;
            InitializeComponent();

            versionLbl.Text = version + " (Beta)";

            using (var stream = GetType().Assembly.GetManifestResourceStream("FortranCodeNavCore.Resources.readme.txt"))
                using (var reader = new StreamReader(stream))
                {
                    shortcutsDetails.Text = reader.ReadToEnd();
                }

            // TODO
            //var commands = ide.CommandManager.Commands;
            //dataGridView1.Columns[2].DefaultCellStyle.ForeColor = Color.Red;
            //foreach (var commandName in commands.Keys)
            //{
            //    var vsCommand = ide.CommandManager.Commands[commandName];
            //    var keyboardBinding = ide.GetKeyBindingForCommand(vsCommand);
            //    var conflicts = keyboardBinding != null
            //                           ? String.Join(", ",ide.GetConflictingCommandsForKeyBinding(vsCommand.Name, keyboardBinding).ToArray())
            //                           : "shortcut missing!";
            //
            //    dataGridView1.Rows.Add(new[] { vsCommand.Name, keyboardBinding, conflicts });
            //}
        }
Ejemplo n.º 3
0
 public VSIntellisense(VisualStudioIDE ide)
 {
     VisualStudio = ide;
     VisualStudio.BeforeKeyPress         = OnBeforeKeyPress;
     VisualStudio.AfterKeyPress          = OnAfterKeyPress;
     VisualStudio.CompleteWordRequested += new EventHandler(VisualStudioCompleteWordRequested);
     InitHook();
 }
Ejemplo n.º 4
0
 public SyntaxTreeMaintainer(VisualStudioIDE visualStudio)
 {
     VisualStudio = visualStudio;
     VisualStudio.CodeFileAdded    += VisualStudioCodeFileAdded;
     VisualStudio.CodeFileModified += VisualStudioCodeFileModified;
     VisualStudio.CodeFileRemoved  += VisualStudioCodeFileRemoved;
     processor = new ParseQueueProcessor(VisualStudio);
 }
Ejemplo n.º 5
0
        public FortranCodeNavCore(VisualStudioIDE visualStudio)
        {
            Version = GetType().Assembly.GetName().Version;

            Log.Write(string.Format("Fortran CodeNav {0} initializing...", Version));

            SyntaxTreeMaintainer = new SyntaxTreeMaintainer(visualStudio);
            VisualStudio         = visualStudio;
            VSLogger.RealLogger  = new LogRedirector();

            VisualStudio.FilePassesFilterDelegate = KeepFile;
            VisualStudio.VisualStudioClosing     += VisualStudioClosing;

            // intellisense
            var fortranIntellisense = new FortranIntellisenseProvider(VisualStudio, SyntaxTreeMaintainer);

            IntellisenseController = new VSIntellisense(VisualStudio)
            {
                OnCodeCompleteActivating = fortranIntellisense.OnCodeCompleteActivating,
                OnCodeCompleteUpdating   = fortranIntellisense.OnCodeCompleteUpdating
            };
        }
Ejemplo n.º 6
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            IComponentModel       componentModel = (IComponentModel)(await GetServiceAsync(typeof(SComponentModel)));
            RunningDocTableEvents runningDocTableEventListener = new RunningDocTableEvents();

            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            IVsRunningDocumentTable iVsRunningDocumentTable =
                (IVsRunningDocumentTable)GetGlobalService(typeof(SVsRunningDocumentTable));

            iVsRunningDocumentTable.AdviseRunningDocTableEvents(runningDocTableEventListener, out uint mRdtCookie);

            DocumentService documentService =
                new DocumentService(iVsRunningDocumentTable, runningDocTableEventListener, componentModel.GetService <VisualStudioWorkspace>());

            OutputWindowHelper.LogWriteLine("XAMLator initialized.");

            VisualStudioIDE visualStudioIDE = new VisualStudioIDE(documentService);

            XAMLatorMonitor.Init(visualStudioIDE);
            XAMLatorMonitor.Instance.StartMonitoring();

            OutputWindowHelper.LogWriteLine("XAMLator Start monitoring...");
        }
Ejemplo n.º 7
0
 public ParseQueueProcessor(VisualStudioIDE visualStudio)
 {
     VisualStudio = visualStudio;
 }
Ejemplo n.º 8
0
 public ShowFileMembersCommand(VisualStudioIDE visualStudio, SyntaxTreeMaintainer syntaxTreeMaintainer) : base(visualStudio, syntaxTreeMaintainer)
 {
 }
 public FortranIntellisenseProvider(VisualStudioIDE visualStudio, SyntaxTreeMaintainer syntaxTreeMaintainer)
     : base(visualStudio, syntaxTreeMaintainer)
 {
 }
Ejemplo n.º 10
0
 public FindUsageCommand(VisualStudioIDE visualStudio, SyntaxTreeMaintainer syntaxTreeMaintainer) : base(visualStudio, syntaxTreeMaintainer)
 {
 }
Ejemplo n.º 11
0
 protected FortranCommandBase(VisualStudioIDE visualStudio, SyntaxTreeMaintainer syntaxTreeMaintainer)
 {
     VisualStudio         = visualStudio;
     SyntaxTreeMaintainer = syntaxTreeMaintainer;
 }
Ejemplo n.º 12
0
 public SyncSolutionExplorerCommand(VisualStudioIDE visualStudio, SyntaxTreeMaintainer syntaxTreeMaintainer) : base(visualStudio, syntaxTreeMaintainer)
 {
 }
Ejemplo n.º 13
0
 public BrowseToCommand(VisualStudioIDE visualStudio, SyntaxTreeMaintainer syntaxTreeMaintainer) : base(visualStudio, syntaxTreeMaintainer)
 {
 }