private void ColorBreakpoint(ISledDocument sd, SledProjectFilesBreakpointType bp)
        {
            if (!m_debugService.IsConnected)
                return;

            if (sd.SledProjectFile == null)
                return;

            // Grab parsed breakpoint line numbers associated with this file
            var parsedBreakpointsLineNumbers = m_luaVariableParserService.ValidBreakpointLineNumbers(sd.SledProjectFile);
            if (parsedBreakpointsLineNumbers == null)
                return;

            // If breakpoint line number not in list then mark it as invalid
            if (!parsedBreakpointsLineNumbers.Contains(bp.Line))
                bp.Breakpoint.BackColor = m_bpInvalidColor;
        }
        private bool PassesBreakpointColorCheck(SledProjectFilesBreakpointType bp)
        {
            if (bp == null)
                return false;

            if (bp.File == null)
                return false;

            if (bp.File.LanguagePlugin != m_luaLanguagePlugin)
                return false;

            if (bp.File.SledDocument == null)
                return false;

            return true;
        }
示例#3
0
        private SledDocumentSyntaxHighlighter GetHighlighter(SledProjectFilesBreakpointType bp)
        {
            if (bp == null)
                return null;

            if (bp.File == null)
                return null;

            if (bp.File.Uri == null)
                return null;

            if (m_documentService == null)
                return null;

            var documentClient = m_documentService.GetDocumentClient(bp.File.Uri);

            return documentClient.SyntaxHighlighter;
        }
示例#4
0
        /// <summary>
        /// Add a breakpoint to a file supplying a condition
        /// </summary>
        /// <param name="file">File to add breakpoint to</param>
        /// <param name="lineNumber">Line number</param>
        /// <param name="condition">Condition</param>
        /// <param name="conditionResult">Whether condition evaluates to true or false</param>
        /// <param name="conditionEnabled">Whether the condition is enabled or not</param>
        /// <param name="useFunctionEnvironment">Whether to use the current function's environment or _G when checking the breakpoint condition (if any)</param>
        /// <param name="breakpoint">The breakpoint if it was added otherwise null</param>
        /// <returns>Whether the breakpoint was added or not</returns>
        public bool AddBreakpoint(SledProjectFilesFileType file, int lineNumber, string condition, bool conditionResult, bool conditionEnabled, bool useFunctionEnvironment, out SledProjectFilesBreakpointType breakpoint)
        {
            breakpoint = null;

            if (file == null)
                return false;

            // Can't add more than one breakpoint per line
            if (IsDuplicate(file, lineNumber))
                return false;

            // Breakpoint in the document (or none if document not open)
            IBreakpoint ibp = null;

            var sd = file.SledDocument;
            if (sd != null)
            {
                m_bAddingOrRemoving = true;

                // Add breakpoint to open document
                sd.Editor.Breakpoint(lineNumber, true);
                ibp = sd.Editor.GetBreakpoint(lineNumber);

                m_bAddingOrRemoving = false;
            }

            // Create project style breakpoint
            breakpoint = SledProjectFilesBreakpointType.Create(ibp);

            // set some properties in case the document isn't open and we don't have a real IBreakpoint yet
            if (ibp == null)
            {
                breakpoint.Line = lineNumber;
                breakpoint.Enabled = true;
            }

            // Setup condition if any
            if (!string.IsNullOrEmpty(condition))
            {
                breakpoint.Condition = condition;
                breakpoint.ConditionResult = conditionResult;
                breakpoint.ConditionEnabled = conditionEnabled;
                breakpoint.UseFunctionEnvironment = useFunctionEnvironment;

                // Draw breakpoint indicator in open document breakpoint
                if (ibp != null)
                    ibp.Marker = true;
            }

            // Add breakpoint to file finally
            file.Breakpoints.Add(breakpoint);
            
            return breakpoint != null;
        }
        private void SendBreakpoint(SledProjectFilesBreakpointType bp)
        {
            if (!m_debugService.IsConnected)
                return;

            if (bp.File == null)
                return;

            if (bp.File.LanguagePlugin == null)
                return;

            //
            // Gather breakpoint details
            //

            // Language plugin that is setting the breakpoint
            var languageId = bp.File.LanguagePlugin.LanguageId;

            // Relative path to script file breakpoint is in
            var relPath = bp.File.Path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

            // Condition if any (only send the condition if the condition is enabled and it isn't null/empty!)
            var condition = (bp.ConditionEnabled && !string.IsNullOrEmpty(bp.Condition)) ? bp.Condition : string.Empty;

            // Create network breakpoint
            var netBp =
                new Shared.Scmp.BreakpointDetails(languageId, relPath, bp.Line, condition, bp.ConditionResult, bp.UseFunctionEnvironment);

            // Send breakpoint to target
            m_debugService.SendScmp(netBp);
        }
示例#6
0
        private void ShowBreakpointConditionFormInternal(SledProjectFilesBreakpointType bp)
        {
            using (var form = new SledBreakpointConditionForm())
            {
                // Store values
                var condition = bp.Condition;
                var bConditionResult = bp.ConditionResult;
                var bConditionEnabled = string.IsNullOrEmpty(condition) ? false : bp.ConditionEnabled;
                var bUseFunctionEnvironment = bp.UseFunctionEnvironment;

                // Setup form
                form.Plugin = bp.File.LanguagePlugin;
                form.SyntaxHighlighter = GetHighlighter(bp);
                form.Condition = condition;
                form.ConditionResult = bConditionResult;
                form.ConditionEnabled = bConditionEnabled;
                form.UseFunctionEnvironment = bUseFunctionEnvironment;

                // Show form
                if (form.ShowDialog(m_mainForm) != DialogResult.OK)
                    return;

                // Update if changed
                if (string.Compare(condition, form.Condition) != 0)
                    bp.Condition = form.Condition;

                // Update if changed
                if (bConditionResult != form.ConditionResult)
                    bp.ConditionResult = form.ConditionResult;

                // Update if changed
                if (bConditionEnabled != form.ConditionEnabled)
                    bp.ConditionEnabled = form.ConditionEnabled;

                // Update if changed
                if (bUseFunctionEnvironment != form.UseFunctionEnvironment)
                    bp.UseFunctionEnvironment = form.UseFunctionEnvironment;
            }
        }
示例#7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="changeType">Breakpoint change type</param>
 /// <param name="bp">Breakpoint type</param>
 public SledBreakpointServiceBreakpointChangingEventArgs(SledBreakpointChangeType changeType, SledProjectFilesBreakpointType bp)
     : this(changeType, bp, -1, -1, null, null)
 {
 }
示例#8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="bp">Breakpoint type</param>
 public SledBreakpointServiceBreakpointEventArgs(SledProjectFilesBreakpointType bp)
 {
     Breakpoint = bp;
 }
示例#9
0
 private SledBreakpointServiceBreakpointChangingEventArgs(SledBreakpointChangeType changeType, SledProjectFilesBreakpointType bp, int iOldLine, int iNewLine, string oldCondition, string newCondition)
 {
     ChangeType = changeType;
     Breakpoint = bp;
     OldLine = iOldLine;
     NewLine = iNewLine;
     OldCondition = oldCondition;
     NewCondition = newCondition;
 }
示例#10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="changeType">Breakpoint change type</param>
 /// <param name="bp">Breakpoint type</param>
 /// <param name="oldCondition">Old breakpoint condition</param>
 /// <param name="newCondition">New breakpoint condition</param>
 public SledBreakpointServiceBreakpointChangingEventArgs(SledBreakpointChangeType changeType, SledProjectFilesBreakpointType bp, string oldCondition, string newCondition)
     : this(changeType, bp, -1, -1, oldCondition, newCondition)
 {
 }
示例#11
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="changeType">Breakpoint change type</param>
 /// <param name="bp">Breakpoint type</param>
 /// <param name="iOldLine">Old breakpoint line number</param>
 /// <param name="iNewLine">New breakpoint line number</param>
 public SledBreakpointServiceBreakpointChangingEventArgs(SledBreakpointChangeType changeType, SledProjectFilesBreakpointType bp, int iOldLine, int iNewLine)
     : this(changeType, bp, iOldLine, iNewLine, null, null)
 {
 }