From 72b9f2b5ddd05a1ce4f870c284c3d59b1a29109a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szentgy=C3=B6rgyi=20Csabi?= Date: Sun, 27 Aug 2023 21:18:06 +0200 Subject: [PATCH] add option to allow omitting $this from context --- Xdebug.sublime-settings | 3 +++ xdebug/settings.py | 3 +++ xdebug/view.py | 2 ++ 3 files changed, 8 insertions(+) diff --git a/Xdebug.sublime-settings b/Xdebug.sublime-settings index 53740a7..e315887 100644 --- a/Xdebug.sublime-settings +++ b/Xdebug.sublime-settings @@ -119,6 +119,9 @@ "cells": [[0, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2]] }, + // Omit $this from context view when debugging. + "omit_this": false, + // Group and index positions for debug views. "breakpoint_group": 2, "breakpoint_index": 1, diff --git a/xdebug/settings.py b/xdebug/settings.py index 76e0518..c4c72a9 100644 --- a/xdebug/settings.py +++ b/xdebug/settings.py @@ -33,6 +33,8 @@ KEY_DISABLE_LAYOUT = 'disable_layout' KEY_DEBUG_LAYOUT = 'debug_layout' +KEY_OMIT_THIS = 'omit_this' + KEY_BREAKPOINT_GROUP = 'breakpoint_group' KEY_BREAKPOINT_INDEX = 'breakpoint_index' KEY_CONTEXT_GROUP = 'context_group' @@ -116,6 +118,7 @@ KEY_BROWSER_NO_EXECUTE, KEY_DISABLE_LAYOUT, KEY_DEBUG_LAYOUT, + KEY_OMIT_THIS, KEY_BREAKPOINT_GROUP, KEY_BREAKPOINT_INDEX, KEY_CONTEXT_GROUP, diff --git a/xdebug/view.py b/xdebug/view.py index 672dd19..e863da6 100644 --- a/xdebug/view.py +++ b/xdebug/view.py @@ -102,6 +102,8 @@ def generate_context_output(context, indent=0): if not isinstance(context, dict): return values for variable in context.values(): + if variable['name'] == '$this' and get_value(S.KEY_OMIT_THIS): + continue has_children = False property_text = '' # Set indentation