aboutsummaryrefslogtreecommitdiff
path: root/lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadllvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py')
-rw-r--r--lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py134
1 files changed, 71 insertions, 63 deletions
diff --git a/lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py b/lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py
index 926cc29..94f79ec 100644
--- a/lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py
+++ b/lldb/utils/vim-lldb/python-vim-lldb/vim_signs.py
@@ -3,71 +3,79 @@
import vim
+
class VimSign(object):
- SIGN_TEXT_BREAKPOINT_RESOLVED = "B>"
- SIGN_TEXT_BREAKPOINT_UNRESOLVED = "b>"
- SIGN_TEXT_PC = "->"
- SIGN_HIGHLIGHT_COLOUR_PC = 'darkblue'
-
- # unique sign id (for ':[sign/highlight] define)
- sign_id = 1
-
- # unique name id (for ':sign place')
- name_id = 1
-
- # Map of {(sign_text, highlight_colour) --> sign_name}
- defined_signs = {}
-
- def __init__(self, sign_text, buffer, line_number, highlight_colour=None):
- """ Define the sign and highlight (if applicable) and show the sign. """
-
- # Get the sign name, either by defining it, or looking it up in the map of defined signs
- key = (sign_text, highlight_colour)
- if not key in VimSign.defined_signs:
- name = self.define(sign_text, highlight_colour)
- else:
- name = VimSign.defined_signs[key]
-
- self.show(name, buffer.number, line_number)
- pass
-
- def define(self, sign_text, highlight_colour):
- """ Defines sign and highlight (if highlight_colour is not None). """
- sign_name = "sign%d" % VimSign.name_id
- if highlight_colour is None:
- vim.command("sign define %s text=%s" % (sign_name, sign_text))
- else:
- self.highlight_name = "highlight%d" % VimSign.name_id
- vim.command("highlight %s ctermbg=%s guibg=%s" % (self.highlight_name,
- highlight_colour,
- highlight_colour))
- vim.command("sign define %s text=%s linehl=%s texthl=%s" % (sign_name,
- sign_text,
- self.highlight_name,
- self.highlight_name))
- VimSign.defined_signs[(sign_text, highlight_colour)] = sign_name
- VimSign.name_id += 1
- return sign_name
-
-
- def show(self, name, buffer_number, line_number):
- self.id = VimSign.sign_id
- VimSign.sign_id += 1
- vim.command("sign place %d name=%s line=%d buffer=%s" % (self.id, name, line_number, buffer_number))
- pass
-
- def hide(self):
- vim.command("sign unplace %d" % self.id)
- pass
+ SIGN_TEXT_BREAKPOINT_RESOLVED = "B>"
+ SIGN_TEXT_BREAKPOINT_UNRESOLVED = "b>"
+ SIGN_TEXT_PC = "->"
+ SIGN_HIGHLIGHT_COLOUR_PC = 'darkblue'
+
+ # unique sign id (for ':[sign/highlight] define)
+ sign_id = 1
+
+ # unique name id (for ':sign place')
+ name_id = 1
+
+ # Map of {(sign_text, highlight_colour) --> sign_name}
+ defined_signs = {}
+
+ def __init__(self, sign_text, buffer, line_number, highlight_colour=None):
+ """ Define the sign and highlight (if applicable) and show the sign. """
+
+ # Get the sign name, either by defining it, or looking it up in the map
+ # of defined signs
+ key = (sign_text, highlight_colour)
+ if key not in VimSign.defined_signs:
+ name = self.define(sign_text, highlight_colour)
+ else:
+ name = VimSign.defined_signs[key]
+
+ self.show(name, buffer.number, line_number)
+ pass
+
+ def define(self, sign_text, highlight_colour):
+ """ Defines sign and highlight (if highlight_colour is not None). """
+ sign_name = "sign%d" % VimSign.name_id
+ if highlight_colour is None:
+ vim.command("sign define %s text=%s" % (sign_name, sign_text))
+ else:
+ self.highlight_name = "highlight%d" % VimSign.name_id
+ vim.command(
+ "highlight %s ctermbg=%s guibg=%s" %
+ (self.highlight_name, highlight_colour, highlight_colour))
+ vim.command(
+ "sign define %s text=%s linehl=%s texthl=%s" %
+ (sign_name, sign_text, self.highlight_name, self.highlight_name))
+ VimSign.defined_signs[(sign_text, highlight_colour)] = sign_name
+ VimSign.name_id += 1
+ return sign_name
+
+ def show(self, name, buffer_number, line_number):
+ self.id = VimSign.sign_id
+ VimSign.sign_id += 1
+ vim.command("sign place %d name=%s line=%d buffer=%s" %
+ (self.id, name, line_number, buffer_number))
+ pass
+
+ def hide(self):
+ vim.command("sign unplace %d" % self.id)
+ pass
+
class BreakpointSign(VimSign):
- def __init__(self, buffer, line_number, is_resolved):
- txt = VimSign.SIGN_TEXT_BREAKPOINT_RESOLVED if is_resolved else VimSign.SIGN_TEXT_BREAKPOINT_UNRESOLVED
- super(BreakpointSign, self).__init__(txt, buffer, line_number)
+
+ def __init__(self, buffer, line_number, is_resolved):
+ txt = VimSign.SIGN_TEXT_BREAKPOINT_RESOLVED if is_resolved else VimSign.SIGN_TEXT_BREAKPOINT_UNRESOLVED
+ super(BreakpointSign, self).__init__(txt, buffer, line_number)
+
class PCSign(VimSign):
- def __init__(self, buffer, line_number, is_selected_thread):
- super(PCSign, self).__init__(VimSign.SIGN_TEXT_PC,
- buffer,
- line_number,
- VimSign.SIGN_HIGHLIGHT_COLOUR_PC if is_selected_thread else None)
+
+ def __init__(self, buffer, line_number, is_selected_thread):
+ super(
+ PCSign,
+ self).__init__(
+ VimSign.SIGN_TEXT_PC,
+ buffer,
+ line_number,
+ VimSign.SIGN_HIGHLIGHT_COLOUR_PC if is_selected_thread else None)