-
Notifications
You must be signed in to change notification settings - Fork 0
Support launching server preinstalled by build tools #354
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
from ensime_shared.util import Util | ||
|
||
BOOTSTRAPS_ROOT = os.path.join(os.environ['HOME'], '.config/ensime-vim/') | ||
BOOTSTRAPS_ROOT = os.path.join(os.environ['HOME'], '.config', 'ensime-vim') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated, but the config folder location could be improved by using XDG for Linux and AppData for Windows. |
||
"""Default directory where ENSIME server bootstrap projects will be created.""" | ||
|
||
LOG_FORMAT = '%(levelname)-8s <%(asctime)s> (%(filename)s:%(lineno)d) - %(message)s' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,9 @@ def __init__(self, vim): | |
self._vim = vim | ||
self.clients = {} | ||
|
||
@property | ||
def using_server_v2(self): | ||
"""Whether user has configured the plugin to use ENSIME v2 protocol.""" | ||
"""bool: Whether user has configured the plugin to use ENSIME v2 protocol.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused, keeping this setting just to choose the client version can't lead to a client and server version mismatch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nvm, it's an undocumented setting so only people knowing what they do should be using it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry about the noise, I think we should get rid of this setting and ask the launcher which version we should use for the client. |
||
return bool(self.get_setting('server_v2', 0)) | ||
|
||
def get_setting(self, key, default): | ||
|
@@ -109,10 +110,11 @@ def create_client(self, config_path): | |
|
||
This will launch the ENSIME server for the project as a side effect. | ||
""" | ||
server_v2 = self.using_server_v2() | ||
config = ProjectConfig(config_path) | ||
editor = Editor(self._vim) | ||
launcher = EnsimeLauncher(self._vim, config_path, server_v2) | ||
if server_v2: | ||
launcher = EnsimeLauncher(self._vim, config) | ||
|
||
if self.using_server_v2: | ||
return EnsimeClientV2(editor, self._vim, launcher) | ||
else: | ||
return EnsimeClientV1(editor, self._vim, launcher) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This little
strategy.isinstalled()
Law of Demeter violation felt dirty for a moment, but I feel the right solution is probably not a delegating method on the launcher itself, but getting this logic entirely out ofEnsimeClient
as per #325. And likely extending to some of the work toward server lifecycle management.