Skip to content

Commit 621d0f9

Browse files
committed
Make it possilbe to turn off the usage of signs
* Since it seems the vim command "sign place" is sometimes slow make it possible to disable the usage of signs completely. Diagnostics will still be processed and possible to display by using the lspDiagnostics command. * Update travis du use create_release.py --dev
1 parent 9d239c1 commit 621d0f9

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: python
22
python:
33
- "3.6"
44
install:
5-
- tools/create_portable_pyls.py
5+
- tools/create_release.py --dev
66
- pip install tox
77
script:
88
- cd plugin; tox

DEVELOPMENT.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ Testing of the pythoncode is done with tox. So first make sure you have tox inst
2727

2828
pip install tox
2929

30+
Optional: To install the supported language servers in the repo run::
31+
32+
tools/create_release --dev
33+
3034
Once tox is installed simply run tox from the plugin folder of vim-liq::
3135

3236
cd ~/path/to/vim-liq-repo/plugin
3337
tox
3438

35-
This will run unittests and linting (currently flake8 is used for linting). As a part of testing
36-
the lsp servers supported will be downloaded/installed locally in plugin/tests/.lsp_install_dir.
37-
This is however only done the first time the test is run. To force a re-install one must manually
38-
remove the .lsp_install_dir.
39+
This will run unittests and linting (currently flake8 is used for linting).
3940

4041
There currently is no tests for the vimscript code.

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ To disbale the default keymap set the following in your .vimrc::
7979

8080
let g:langIQ_disablekeymap = 1
8181

82-
Diagnostics is automatically enabled and uses vim marks. When moving to a line with a diagnostics
82+
Diagnostics is automatically enabled and uses vim signs. When moving to a line with a diagnostics
8383
mark the message for that line is displayed in the command-line.
8484

85+
To disable the usage of signs set the following in your .vimrc::
86+
87+
let g:langIQ_disablesigns = 1
88+
8589
Additional commands:
8690

8791
| **LspDiagnostics:** Display diagnostics in the quickfix window.

plugin/vim_liq.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ endif
3535
if !exists("g:langIQ_disablekeymap")
3636
let g:langIQ_disablekeymap = 0
3737
endif
38+
if !exists("g:langIQ_disablesigns")
39+
let g:langIQ_disablesigns = 0
40+
endif
3841
let g:vim_lsp_logdir = expand("<sfile>:h")."/log/"
3942
let g:vim_lsp_log_to_file = 0
4043
let g:vim_lsp_debug = 1

plugin/vimliq/client.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import logging
2121
import os
2222
import re
23+
import time
2324

2425
import lsp.client
2526
import lsp.jsonrpc
@@ -102,14 +103,17 @@ class VimLspClient(object):
102103
VimLspClient also expose functions for communicating with the server.
103104
"""
104105

105-
def __init__(self, start_cmd, transport):
106+
def __init__(self, start_cmd, transport, use_signs=True):
106107
"""Initialize
107108
108109
Args:
109-
supported_clients(dict): See supported_clients.json
110+
start_cmd(str): Command used to start LSP server connected to this client.
111+
transport(str): Currently only "STDIO" is supported.
112+
use_signs(bool): If True use vim "signs".
110113
"""
111114
self._start_cmd = start_cmd
112115
self._transport = transport
116+
self._use_signs = use_signs
113117
self.td_version = 0
114118
self._sign_id = 1
115119
self.diagnostics = {}
@@ -131,6 +135,7 @@ def start_server(self):
131135
self._client.initialize(root_path=path, root_uri="file://" + path)
132136

133137
def _next_sign_id(self):
138+
log.debug("next sign %s", time.time())
134139
self._sign_id += 1
135140
file_ = V.current_file()
136141
all_ids = set(re.findall("id=(\d+)", V.vim_command("sign place file={}".format(file_))))
@@ -140,6 +145,7 @@ def _next_sign_id(self):
140145
self._sign_id = 1
141146
self._sign_id += 1
142147

148+
log.debug("next sign %s", time.time())
143149
return self._sign_id
144150

145151
@staticmethod
@@ -180,7 +186,7 @@ def process_diagnostics(self):
180186
for diag in self._client.diagnostics():
181187
local_uri = self._parse_uri(diag.uri)
182188
self.diagnostics[local_uri] = diag.diagnostics
183-
if local_uri == cur_file:
189+
if local_uri == cur_file and self._use_signs:
184190
self.update_signs()
185191

186192
def display_diagnostics(self):

plugin/vimliq/clientmanager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from . import client
2828
from . import vimutils as V
2929

30+
import vim
3031

3132
log = logging.getLogger(__name__)
3233
log.addHandler(logging.NullHandler())
@@ -58,6 +59,7 @@ def __init__(self, supported_clients):
5859
Attributes:
5960
clients(dict): Dict where key is the language and value is the client object.
6061
"""
62+
self._use_signs = vim.eval("g:langIQ_disablesigns") == "0"
6163
self._supported_clients = supported_clients
6264
self.clients = {}
6365

@@ -77,7 +79,7 @@ def add_client(self):
7779

7880
log.debug("Starting client, start_cmd: %s, transport: %s", start_cmd, transport)
7981
try:
80-
l_client = client.VimLspClient(start_cmd, transport)
82+
l_client = client.VimLspClient(start_cmd, transport, use_signs=self._use_signs)
8183
l_client.start_server()
8284
log.debug("Added client for %s", ft)
8385
self.clients[ft] = l_client

0 commit comments

Comments
 (0)