[PATCH] D138234: [clang-format] Support new file formatting with vim

Jinsong Ji via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 07:55:38 PST 2022


jsji updated this revision to Diff 476905.
jsji added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138234/new/

https://reviews.llvm.org/D138234

Files:
  clang/tools/clang-format/clang-format.py


Index: clang/tools/clang-format/clang-format.py
===================================================================
--- clang/tools/clang-format/clang-format.py
+++ clang/tools/clang-format/clang-format.py
@@ -41,11 +41,11 @@
 
 import difflib
 import json
+import os.path
 import platform
 import subprocess
 import sys
 import vim
-import os.path
 
 # set g:clang_format_path to the path to clang-format if it is not on the path
 # Change this to the full path if clang-format is not on the path.
@@ -77,7 +77,8 @@
   # Determine range to format.
   if vim.eval('exists("l:lines")') == '1':
     lines = ['-lines', vim.eval('l:lines')]
-  elif vim.eval('exists("l:formatdiff")') == '1' and os.path.exists(vim.current.buffer.name):
+  elif vim.eval('exists("l:formatdiff")') == '1' and \
+       os.path.exists(vim.current.buffer.name):
     with open(vim.current.buffer.name, 'r') as f:
       ondisk = f.read().splitlines();
     sequence = difflib.SequenceMatcher(None, ondisk, vim.current.buffer)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138234.476905.patch
Type: text/x-patch
Size: 1002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221121/7471925f/attachment.bin>


More information about the cfe-commits mailing list