Skip to content

Commit

Permalink
Version 0.9.7.0
Browse files Browse the repository at this point in the history
 - VIMCCC supprts auto popup completing menu now. Need +clientserver feature with vim.
 - Added "Parse Workspace (Full, Async)" and "Parse Workspace (Quick, Async)" workspace menu items.
 - Improved gtags integration.
 - Imporved VLWorkspaceOpen command. Now you can run ':tabnew | VLWorkspaceOpen' to open a new tab to work.
 - Fixed a OmniCpp symbols jumping issue.
 - Fixed a debugger issue which conflict with tagbar plugin.
  • Loading branch information
fanhed authored and vim-scripts committed Jan 28, 2013
1 parent fbff966 commit cd00cb1
Show file tree
Hide file tree
Showing 17 changed files with 1,294 additions and 281 deletions.
1,479 changes: 1,218 additions & 261 deletions VimLite.vba → VimLite.vmb

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions vimlite/VimLite/Globals.py
Expand Up @@ -16,7 +16,7 @@
# TODO: 现在的变量展开是不支持递归的,例如 $(a$(b))

# 版本号 850 -> 0.8.5.0
VIMLITE_VER = 960
VIMLITE_VER = 970

# VimLite 起始目录
VIMLITE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down Expand Up @@ -85,7 +85,9 @@ def EscStr4MkSh(string):
参考 vim 的 shellescape() 函数'''
global patMkShStr
if IsWindowsOS():
return '"%s"' % string.replace('"', '""')
#return '"%s"' % string.replace('"', '""')
# 在 Windows 下直接不支持带空格的路径好了,因为用双引号也有各种问题
return '%s' % string
else:
#return EscapeString(string, "|&;()<> \t'\"\\")
# 有必要才转义,主要是为了好看
Expand Down Expand Up @@ -561,7 +563,8 @@ def run(self):

def RunSimpleThread(callback, prvtData):
thrd = SimpleThread(callback, prvtData)
return thrd.start()
thrd.start()
return thrd

def GetBgThdCnt():
return threading.active_count() - 1
Expand Down
Binary file modified vimlite/VimLite/Globals.pyc
Binary file not shown.
34 changes: 25 additions & 9 deletions vimlite/VimLite/TagsStorageSQLite.py
Expand Up @@ -13,6 +13,22 @@
import platform
import sqlite3

# 这两个变量暂时只对本模块生效
CPP_SOURCE_EXT = set(['c', 'cpp', 'cxx', 'c++', 'cc'])
CPP_HEADER_EXT = set(['h', 'hpp', 'hxx', 'hh', 'inl', 'inc', ''])

# 由于无后缀名的文件会视为 c++ 的头文件,所以需要添加一个检查,以下无后缀文件
# 肯定不是 c++ 头文件。不区分大小写
____li = [
'Makefile',
'Kconfig',
'README',
'configure',
'ChangeLog',
'INSTALL',
]
CPP_HEADER_EXCLUDE = set([i.lower() for i in ____li])

def Escape(string, chars):
result = ''
for char in string:
Expand Down Expand Up @@ -194,7 +210,7 @@ def CreateSchema(self):
# mod on 2011-01-07
# 不同源文件文件之间会存在相同的符号
sql = "CREATE UNIQUE INDEX IF NOT EXISTS TAGS_UNIQ on TAGS("\
"file, kind, path, signature);"
"file, line, kind, path, signature);"
self.db.execute(sql)

sql = "CREATE INDEX IF NOT EXISTS KIND_IDX on TAGS(kind);"
Expand Down Expand Up @@ -1336,10 +1352,6 @@ def AppendCtagsOpt(opt):
CTAGS_OPTS += ' ' + opt
CTAGS_OPTS_LIST += [opt]


CPP_SOURCE_EXT = set(['c', 'cpp', 'cxx', 'c++', 'cc'])
CPP_HEADER_EXT = set(['h', 'hpp', 'hxx', 'hh', 'inl', 'inc', ''])

def IsCppSourceFile(fileName):
ext = os.path.splitext(fileName)[1][1:]
if ext in CPP_SOURCE_EXT:
Expand All @@ -1349,6 +1361,10 @@ def IsCppSourceFile(fileName):

def IsCppHeaderFile(fileName):
ext = os.path.splitext(fileName)[1][1:]

if not ext and os.path.basename(fileName).lower() in CPP_HEADER_EXCLUDE:
return False

if ext in CPP_HEADER_EXT:
return True
else:
Expand Down Expand Up @@ -1456,7 +1472,7 @@ def CppTagsDbParseFilesAndStore(dbFile, files, macrosFiles = []):
def ParseFile(fileName, macrosFiles = []):
return ParseFiles([fileName], macrosFiles)

def ParseFilesAndStore(storage, files, macrosFiles = [], filterNonNeed = True,
def ParseFilesAndStore(storage, files, macrosFiles = [], filterNotNeed = True,
indicator = None, useCppTagsDb = False):
# 确保打开了一个数据库
if not storage.OpenDatabase():
Expand All @@ -1467,7 +1483,7 @@ def ParseFilesAndStore(storage, files, macrosFiles = [], filterNonNeed = True,
if IsCppSourceFile(f) or IsCppHeaderFile(f)]

# 过滤不需要的. 通过比较时间戳
if filterNonNeed:
if filterNotNeed:
filesMap = storage.GetFilesMap(tmpFiles)
mapLen = len(tmpFiles)
idx = 0
Expand Down Expand Up @@ -1573,15 +1589,15 @@ def test():
#storage.RecreateDatabase()
#t1 = time.time()
#ParseFilesAndStore(storage, files,
#filterNonNeed = False, useCppTagsDb = True)
#filterNotNeed = False, useCppTagsDb = True)
#t2 = time.time()
#print "%f" % (t2 - t1)

storage.OpenDatabase('test2.db')
storage.RecreateDatabase()
t1 = time.time()
ParseFilesAndStore(storage, files, macrosFiles,
filterNonNeed = False, useCppTagsDb = False)
filterNotNeed = False, useCppTagsDb = False)
t2 = time.time()
print "%f" % (t2 - t1)

Expand Down
Binary file modified vimlite/VimLite/TagsStorageSQLite.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion vimlite/VimLite/VIMClangCC.py
Expand Up @@ -265,7 +265,7 @@ def GetVimCodeCompleteResults(self, sFileName, nLine, nCol,

# 如果要求匹配部分字符串,先过滤一次
if sBase:
print sBase
#print sBase
if bIgnoreCase:
patBase = re.compile('^' + sBase, re.IGNORECASE)
else:
Expand Down
Binary file modified vimlite/VimLite/VIMClangCC.pyc
Binary file not shown.
27 changes: 27 additions & 0 deletions vimlite/VimLite/VLWorkspaceSettings.py
Expand Up @@ -55,6 +55,20 @@ def __init__(self, fileName = ''):
self.cSrcExts = []
self.cppSrcExts = []

# 2013-01-23: 工作区配置信息,每个工作区可有自己的配置,覆盖全局配置
self.enableLocalConfig = False # 是否使用工作区自己的配置
# 工作区配置信息。配置信息包括几大类
# 'Base' : 基本配置
# 'VIMCCC' : VIMCCC 的配置
# 'OmniCpp' : OmniCpp 的配置
# 'Debugger': 调试器的配置
self.localConfig = {
'Base' : {},
'VIMCCC' : {},
'OmniCpp' : {},
'Debugger' : {},
}

# 如果指定了 fileName, 从文件载入, 不论成功与否
self.Load()

Expand Down Expand Up @@ -143,6 +157,17 @@ def GetIncPathFlagWords(self):
def GetCurIncPathFlagWord(self):
return self.INC_PATH_FLAG_WORDS[self.incPathFlag]

def GetLocalConfigScript(self):
'''把 localConfig 字典转为 vim 脚本形式的文本。主要用于设置时提取'''
li = []
for name, conf in self.localConfig.iteritems():
for k, v in conf.iteritems():
if isinstance(v, str):
li.append("let %s = '%s'" % (k, v.replace("'", "''")))
else:
li.append('let %s = %d' % (k, v))
return '\n'.join(li)

def SetIncPathFlag(self, flag):
if isinstance(flag, str):
if flag in self.INC_PATH_FLAG_WORDS:
Expand Down Expand Up @@ -181,6 +206,8 @@ def Load(self, fileName = ''):
self.editorOptions = obj.editorOptions
self.cSrcExts = obj.cSrcExts
self.cppSrcExts = obj.cppSrcExts
self.enableLocalConfig = obj.enableLocalConfig
self.localConfig = obj.localConfig
except:
pass
del obj
Expand Down
Binary file modified vimlite/VimLite/VLWorkspaceSettings.pyc
Binary file not shown.
12 changes: 8 additions & 4 deletions vimlite/VimLite/VimTagsManager.py
Expand Up @@ -63,7 +63,8 @@ class ParseFilesThread(threading.Thread):
lock = threading.Lock()

def __init__(self, dbFile, files, macrosFiles = [],
PostCallback = None, callbackPara = None):
PostCallback = None, callbackPara = None,
filterNotNeed = True):
'''
异步 parse 文件线程
NOTE: sqlite3 是线程安全的
Expand All @@ -77,6 +78,7 @@ def __init__(self, dbFile, files, macrosFiles = [],

self.PostCallback = PostCallback
self.callbackPara = callbackPara
self.filterNotNeed = filterNotNeed

def run(self):
ParseFilesThread.lock.acquire()
Expand All @@ -85,7 +87,7 @@ def run(self):
storage = TagsStorage.TagsStorageSQLite()
storage.OpenDatabase(self.dbFile)
TagsStorage.ParseFilesAndStore(storage, self.files,
self.macrosFiles)
self.macrosFiles, self.filterNotNeed)
del storage
except:
print 'ParseFilesThread() failed'
Expand Down Expand Up @@ -118,7 +120,8 @@ def RecreateDatabase(self):
self.storage.RecreateDatabase()

def AsyncParseFiles(self, files, macrosFiles = [],
PostCallback = None, callbackPara = None):
PostCallback = None, callbackPara = None,
filterNotNeed = True):
# 暂时只允许单个异步 parse
try:
self.parseThread.join()
Expand All @@ -127,7 +130,8 @@ def AsyncParseFiles(self, files, macrosFiles = [],

self.parseThread = ParseFilesThread(self.storage.GetDatabaseFileName(),
files, macrosFiles,
PostCallback, callbackPara)
PostCallback, callbackPara,
filterNotNeed)
self.parseThread.start()

def ParseFiles(self, files, macrosFiles = [], indicator = None):
Expand Down
Binary file modified vimlite/VimLite/VimTagsManager.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion vimlite/VimLite/VimUtils.py
Expand Up @@ -6,7 +6,9 @@
import json

def ToVimEval(o):
'''把 python 字符串列表和字典转为健全的能被 vim 解析的数据结构'''
'''把 python 字符串列表和字典转为健全的能被 vim 解析的数据结构
对于整个字符串的引用必须使用双引号,例如:
vim.command("echo %s" % ToVimEval(expr))'''
if isinstance(o, str):
return "'%s'" % o.replace("'", "''")
elif isinstance(o, unicode):
Expand Down
Binary file modified vimlite/VimLite/VimUtils.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion vimlite/config/BuildSettings.jcnf
Expand Up @@ -2,7 +2,7 @@
"activeBuilder": "GNU makefile for g++/gcc",
"builders": [
{
"command": "make -j 2 -f",
"command": "make -f",
"name": "GNU makefile for g++/gcc"
}
],
Expand Down
6 changes: 5 additions & 1 deletion vimlite/pyclewn/clewn/debugger.py
Expand Up @@ -151,7 +151,11 @@
let ei = &eventignore
set nosplitright
set nosplitbelow
set eventignore+=WinEnter,WinLeave
if a:bufname =~# '_console$'
set eventignore=all
else
set eventignore+=WinEnter,WinLeave
endif
let prevbuf_winnr = bufwinnr(bufname("%"))
if winnr("$") == 1 && (a:location == "right" || a:location == "left")
let split = "vsplit"
Expand Down
Binary file modified vimlite/pyclewn/clewn/debugger.pyc
Binary file not shown.
Binary file modified vimlite/pyclewn/clewn/gdb.pyc
Binary file not shown.

0 comments on commit cd00cb1

Please sign in to comment.