Skip to content

Commit

Permalink
Merge branch 'git_dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hy172574895 committed Jan 20, 2021
2 parents 9f68e12 + 848e5da commit 4530455
Show file tree
Hide file tree
Showing 9 changed files with 467 additions and 21 deletions.
6 changes: 5 additions & 1 deletion autoload/ECY/diagnosis.vim
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ endfunction
function! ECY#diagnosis#PlaceSign(msg) abort
"{{{Place Sign and highlight it. partly or all
let l:engine_name = a:msg['EngineName']
if !g:ECY_enable_diagnosis || l:engine_name == ''
if !g:ECY_enable_diagnosis || l:engine_name == '' || type(a:msg) != 4 ||
\!has_key(a:msg, 'Lists') || type(a:msg['Lists']) != 3
return
endif
call s:UpdateDiagnosisByEngineName(a:msg) " but don't show sign, just update variable.
Expand Down Expand Up @@ -519,6 +520,9 @@ function! s:InitDiagnosisLists() abort
"{{{return lists
let l:temp = []
for [key, lists] in items(g:ECY_diagnosis_items_with_engine_name)
if type(lists) != 3 " is not list
continue
endif
call extend(l:temp, lists)
endfor
let g:ECY_diagnosis_items_all = l:temp
Expand Down
14 changes: 12 additions & 2 deletions autoload/ECY/install.vim
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function! ECY#install#Init() abort
\'','lib.sources.lsp_servers.texlab',
\function('ECY#install#texlab'), '', v:true)

call ECY#install#AddEngineInfo('vue_vls',
\'','lib.sources.lsp_servers.vue',
\function('ECY#install#vue_vls'), '', v:true)

call ECY#install#AddEngineInfo('intelephense',
\'','lib.sources.lsp_servers.intelephense',
\function('ECY#install#texlab'), '', v:true)
Expand Down Expand Up @@ -147,7 +151,7 @@ function! ECY#install#AddCapabilities() abort
"}}}
endfunction

function! ECY#install#AddLspSetting(engine_info) abort
function! ECY#install#AddLspSetting(engine_name) abort
"{{{
if exists('g:loaded_lsp_settings') && exists('g:ECY_lsp_setting_dict')
let g:ECY_all_engine_info[a:engine_name]['lsp_setting'] = g:ECY_lsp_setting_dict
Expand Down Expand Up @@ -195,7 +199,7 @@ function! ECY#install#AddEngineInfo(engine_name, client_module_path,
else
let g:ECY_all_engine_info[a:engine_name]['is_buildin'] = v:false
endif
call ECY#install#AddLspSetting(g:ECY_all_engine_info[a:engine_name])
call ECY#install#AddLspSetting(a:engine_name)
"}}}
endfunction

Expand Down Expand Up @@ -458,6 +462,12 @@ function! ECY#install#texlab() abort
"}}}
endfunction

function! ECY#install#vue_vls() abort
"{{{
return {'status':'0','description':"ok",'lib': 'lib.sources.lsp_servers.vue', 'name':'vue_vls', 'path': ''}
"}}}
endfunction

function! ECY#install#Go_langserver() abort
"{{{
if !ECY#utility#CMDRunable(get(g:,'ECY_golangserver_starting_cmd','go-langserver'))
Expand Down
6 changes: 3 additions & 3 deletions python/client/ECY/utils/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _get_snippets(self, is_reflesh=False):
results['UltisnipsSnippets'] = self._snippets_cache
except:
results = {'HasSnippetSupport': False}
g_logger.exception("Failed to load snippets.")
g_logger.debug("Failed to load snippets.")
return results

def _list_preview_file(self):
Expand All @@ -151,7 +151,7 @@ def _list_preview_file(self):
self.preview_file_list.append(item)
g_logger.debug(self.preview_file_list)
except:
g_logger.exception("have no preview file path.")
g_logger.debug("have no preview file path.")
self.preview_file_dir = 'failed to get variable.'
self.preview_file_list = []
return self.preview_file_list
Expand All @@ -164,7 +164,7 @@ def _read_preview_file(self, file_path):
f.close()
return dicts
except:
g_logger.exception("Failed to load preview file.")
g_logger.debug("Failed to load preview file.")
return {}

def _get_preview_content(self):
Expand Down
3 changes: 2 additions & 1 deletion python/client/leaderf_plugin/selecting.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def _createHelp(self):
help.append('" <CR>/<double-click>/o : execute command under cursor')
help.append(
'" x : open file under cursor in a horizontally split window')
help.append('" v : open file under cursor in a vertically split window')
help.append(
'" v : open file under cursor in a vertically split window')
help.append('" t : open file under cursor in a new tabpage')
help.append('" i : switch to input mode')
help.append('" p : preview the result')
Expand Down
8 changes: 5 additions & 3 deletions python/server/lib/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def DoCompletion(self, engine_obj, version):
original_colum = version['StartPosition']['Colum']
current_line = version['StartPosition']['Line']
current_line_text = version['CurrentLineText']
pre_words = current_line_text[:original_colum]
temp = bytes(current_line_text, encoding='utf-8')
pre_words = str(temp[:original_colum], encoding='utf-8')
# pre_words = current_line_text[:original_colum]
current_colum, filter_words, last_key = \
self.FindStart(pre_words, source_info['Regex'])
current_start_postion = \
Expand All @@ -60,8 +62,8 @@ def DoCompletion(self, engine_obj, version):
self.start_position[engine_name] = {'Line': 0, 'Colum': 0, 'OriginalColum': 0}

cache_position = self.start_position[engine_name]
g_logger.debug(cache_position)
g_logger.debug(current_start_postion)
g_logger.debug(pre_words)
g_logger.debug(filter_words)
if current_start_postion['Line'] != cache_position['Line']\
or current_start_postion['Colum'] != cache_position['Colum']\
or cache_position['OriginalColum'] >= original_colum\
Expand Down
26 changes: 17 additions & 9 deletions python/server/lib/completor_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ def _get_cache_file(self):
self._cache_file_name = path_temp + '/ECY_server_config.ini'
return self._cache_file_name

def _load_config(self):
"""
"""
def _write_default_config(self):
path_temp = self._get_cache_file()
if not os.path.exists(path_temp):
# default config
fp = open(path_temp, mode="w", encoding='utf-8')
with open(path_temp, mode='w', encoding='utf-8') as f:
installed_engine_lib = \
{'label': 'lib.sources.label.Label',
'path': 'lib.sources.path.path',
Expand All @@ -62,10 +58,22 @@ def _load_config(self):
self.conf['installed_engine_lib'] = installed_engine_lib
self.conf['installed_engine_path'] = installed_engine_path
self.conf['filetype_using'] = {}
self.conf.write(fp)
fp.close()
self.conf.write(f)
return installed_engine_lib, installed_engine_path

def _load_config(self):
"""
"""
path_temp = self._get_cache_file()
if not os.path.exists(path_temp):
# default config
return self._write_default_config()
else:
self.conf.read(path_temp)
try:
self.conf.read(path_temp)
except Exception as e:
g_logger.debug(e)
return self._write_default_config() # return default config
installed_engine_lib = self.conf['installed_engine_lib']
installed_engine_path = self.conf['installed_engine_path']
return installed_engine_lib, installed_engine_path
Expand Down
2 changes: 1 addition & 1 deletion python/server/lib/sources/lsp_servers/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self):
threading.Thread(target=self._handle_diagnosis).start()

def GetInfo(self):
return {'Name': self._name, 'WhiteList': ['html', 'xhtml'],
return {'Name': self._name, 'WhiteList': ['html', 'xhtml', 'vue'],
'Regex': r'[A-Za-z0-9\_\-]',
'TriggerKey': ['.', ':', '"', '\'', '<', '=', '/']}

Expand Down
Loading

0 comments on commit 4530455

Please sign in to comment.