コード例 #1
0
        private static void EndFindReferences(OutputPane pane, IEnumerable <Reference> refs)
        {
            var refList = refs.ToList();

            refList.Sort();
            Reference.ResolveContext(refList);

            string lastFileName   = null;
            int    lastLineNumber = -1;
            int    lastLineOffset = -1;
            var    refCount       = 0;

            foreach (var r in refList)
            {
                if (!string.Equals(r.FileName, lastFileName, StringComparison.OrdinalIgnoreCase) ||
                    r.LineNumber != lastLineNumber ||
                    r.LineOffset != lastLineOffset)
                {
                    pane.WriteLine(string.Format("  {0}({1},{2}): {3}", r.FileName, r.LineNumber + 1, r.LineOffset + 1, r.Context, r.Global ? "global" : "local"));
                    refCount++;

                    lastFileName   = r.FileName;
                    lastLineNumber = r.LineNumber;
                    lastLineOffset = r.LineOffset;
                }
            }

            pane.WriteLine(string.Format("{0} reference(s) found.", refCount));
        }
コード例 #2
0
 public void Log(FunctionId functionId, LogMessage logMessage)
 {
     OutputPane.WriteLine(
         string.Format(
             "[{0}] {1} - {2}",
             Environment.CurrentManagedThreadId,
             functionId.ToString(),
             logMessage.GetMessage()
             )
         );
 }
コード例 #3
0
        public void Run()
        {
            if (_pane != null)
            {
                _pane.WriteLine(string.Format("Starting code analysis on file: {0}", _codeModel.FileName));
            }

            _prepModel  = _codeModel.PreprocessorModel;
            _fullSource = _codeModel.Source.Text;

            ErrorTaskProvider.Instance.RemoveAllForSource(ErrorTaskSource.CodeAnalysis, _codeModel.FileName);

            foreach (var func in _prepModel.LocalFunctions)
            {
                AnalyzeFunction(func);
            }

            ErrorTaskProvider.Instance.FireTagsChangedEvent();

            if (_pane != null)
            {
                _pane.WriteLine(string.Format("Code analysis complete: {0} error(s), {1} warning(s)", _numErrors, _numWarnings));
            }
        }
コード例 #4
0
 public void LogBlockStart(
     FunctionId functionId,
     LogMessage logMessage,
     int uniquePairId,
     CancellationToken cancellationToken
     )
 {
     OutputPane.WriteLine(
         string.Format(
             "[{0}] Start({1}) : {2} - {3}",
             Environment.CurrentManagedThreadId,
             uniquePairId,
             functionId.ToString(),
             logMessage.GetMessage()
             )
         );
 }
コード例 #5
0
        public void LogBlockEnd(
            FunctionId functionId,
            LogMessage logMessage,
            int uniquePairId,
            int delta,
            CancellationToken cancellationToken
            )
        {
            var functionString =
                functionId.ToString()
                + (cancellationToken.IsCancellationRequested ? " Canceled" : string.Empty);

            OutputPane.WriteLine(
                string.Format(
                    "[{0}] End({1}) : [{2}ms] {3}",
                    Environment.CurrentManagedThreadId,
                    uniquePairId,
                    delta,
                    functionString
                    )
                );
        }
コード例 #6
0
        /// <summary>
        ///     Called when the language client receives a log message from the language server.
        /// </summary>
        /// <param name="message">
        ///     The message text.
        /// </param>
        /// <param name="messageType">
        ///     The message type.
        /// </param>
        async void LanguageClient_LogMessage(string message, MessageType messageType)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            OutputPane.WriteLine("[{0}] {1}", messageType, message);
        }
コード例 #7
0
ファイル: ProbeCompiler.cs プロジェクト: cmrazek/DkTools
        private void CompileThreadOutput(string line, bool stdErr)
        {
            if (_pane == null)
            {
                return;
            }

            var index = line.IndexOf(": error :");

            if (index >= 0)
            {
                string fileName;
                int    lineNum;
                if (ParseFileNameAndLine(line.Substring(0, index), out fileName, out lineNum))
                {
                    var message = line.Substring(index + ": error :".Length).Trim();
                    var task    = new DkTools.ErrorTagging.ErrorTask(fileName, lineNum - 1, -1, message, ErrorType.Error, ErrorTaskSource.Compile, null, null);
                    ErrorTaskProvider.Instance.Add(task);
                }
                _pane.WriteLine(line);
                _numErrors++;
                return;
            }

            index = line.IndexOf(": warning :");
            if (index >= 0)
            {
                string fileName;
                int    lineNum;
                if (ParseFileNameAndLine(line.Substring(0, index), out fileName, out lineNum))
                {
                    var message = line.Substring(index + ": warning :".Length).Trim();
                    var task    = new DkTools.ErrorTagging.ErrorTask(fileName, lineNum - 1, -1, message, ErrorType.Warning, ErrorTaskSource.Compile, null, null);
                    ErrorTaskProvider.Instance.Add(task);
                }
                _pane.WriteLine(line);
                _numWarnings++;
                return;
            }

            if (line.StartsWith("LINK : fatal error"))
            {
                var message = line.Substring("LINK : fatal error".Length).Trim();
                var task    = new DkTools.ErrorTagging.ErrorTask(string.Empty, 0, -1, message, ErrorType.Error, ErrorTaskSource.Compile, null, null);
                _pane.WriteLine(line);
                _numErrors++;
                return;
            }

            if (line.Equals("Build failed."))
            {
                var task = new DkTools.ErrorTagging.ErrorTask(string.Empty, 0, -1, "Build failed.", ErrorType.Error, ErrorTaskSource.Compile, null, null);
                ErrorTaskProvider.Instance.Add(task);
                _buildFailed = true;
                _pane.WriteLine(line);
                return;
            }

            if (line.IndexOf("Compile failed", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                var task = new DkTools.ErrorTagging.ErrorTask(string.Empty, 0, -1, line, ErrorType.Error, ErrorTaskSource.Compile, null, null);
                ErrorTaskProvider.Instance.Add(task);
                _buildFailed = true;
                _pane.WriteLine(line);
                return;
            }

            Match match;

            if ((match = _rxLinkError.Match(line)).Success)
            {
                _pane.WriteLineAndTask(line, line.Substring(match.Groups[1].Index), OutputPane.TaskType.Error, "", 0);
                _numErrors++;
                return;
            }

            _pane.WriteLine(line);
        }