You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by oxygen311 <gi...@git.apache.org> on 2018/07/23 11:48:18 UTC

[GitHub] zeppelin pull request #3090: [Zeppelin-3645] Add LSP Protocol completion sup...

GitHub user oxygen311 opened a pull request:

    https://github.com/apache/zeppelin/pull/3090

    [Zeppelin-3645] Add LSP Protocol completion support

    ### What is this PR for?
    Add support of request autocomplete with LSP Protocol through TCP.
    
    ### What type of PR is it?
    Feature
    
    ### What is the Jira issue?
    [ZEPPELIN-3645](https://issues.apache.org/jira/projects/ZEPPELIN/issues/ZEPPELIN-3645?filter=allopenissues)
    
    ### Demo
    ![peek 2018-07-23 14-40](https://user-images.githubusercontent.com/16215034/43074811-3a8b3a00-8e87-11e8-8333-c2d678e61557.gif)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/TinkoffCreditSystems/zeppelin ZEPPELIN-3645

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zeppelin/pull/3090.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3090
    
----
commit 299fc9a68509395903c2e7dd37a1b011909b1e15
Author: oxygen311 <al...@...>
Date:   2018-07-20T16:07:10Z

    Add basic support of LSP Protocol

commit f0066adb379afaf4ee442f4c4e6bef9ae7ec9473
Author: oxygen311 <al...@...>
Date:   2018-07-23T09:20:43Z

    Fix variable name

----


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @zjffdu 
    Sorry, correct line is `pip install python-language-server`, i will fix it.


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @oxygen311 This is what I concern about the behavior consistency. Let's assume user use PySpark (ipython is disabled). User may find code completion works pretty well in p1, but works badly in p2 because LSP only works in paragraph level. 
    
    BTW, it is weird to me that LSP don't support concept of session. That would mean If I am writing a long code (1000 lines of code), I need to send all these code to LSP for code completion each time, this seems very inefficient.  But I may be wrong. I am so familiar with LSP. Just want to confirm whether there's more efficient way to use LSP


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Now this feature is enabled only in python interpreter. So you can specify `zeppelin.python.lspHost` and `zeppelin.python.lspPort` properties and use it.
    Server is a separate process. I have been using [python-language-server](https://github.com/palantir/python-language-server). But there are much more [server implementations](https://microsoft.github.io/language-server-protocol/implementors/servers/) that can be used with any language.


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Could you add instruction in python.md ? Otherwise it is hard for users to know how to enable this feature except you. 


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by mebelousov <gi...@git.apache.org>.
Github user mebelousov commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @felixcheung I agree that support of LSP in Zeppelin is unmature idea.
    
    Share please undesired cases with open ip and port.


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @zjffdu Sound like good idea)
    Done



---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    open ip and port to connect to has become a huge problem recently, so unless LSP has some sort of authentication story, my vote would be "no" even if this is disabled by default, because this can become a support issue when users do have it enable.
    
    https://github.com/apache/zeppelin/pull/3090#pullrequestreview-139750764



---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @oxygen311 I can not install it. Let me know if there any other dependency I need to install
    
    ```
    ➜  zeppelin pr/3090 ✗ pip install pyls
    Collecting pyls
      Using cached https://files.pythonhosted.org/packages/de/b7/5a056c2cac8fd19c905ae7451c2a60b9195531959c3770a49d6be4d905e3/pyls-0.1.3.zip
        Complete output from command python setup.py egg_info:
        Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
        Traceback (most recent call last):
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 143, in use_setuptools
            raise ImportError
        ImportError
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup.py", line 31, in <module>
            main()
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup.py", line 11, in main
            distribute_setup.use_setuptools()
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 145, in use_setuptools
            return _do_download(version, download_base, to_dir, download_delay)
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 124, in _do_download
            to_dir, download_delay)
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 193, in download_setuptools
            src = urlopen(url)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 223, in urlopen
            return opener.open(url, data, timeout)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 532, in open
            response = meth(req, response)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 642, in http_response
            'http', request, response, code, msg, hdrs)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 570, in error
            return self._call_chain(*args)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 504, in _call_chain
            result = func(*args)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 650, in http_error_default
            raise HTTPError(req.full_url, code, msg, hdrs, fp)
        urllib.error.HTTPError: HTTP Error 403: SSL is required
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/
    ```


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    1. LSP is usable and powerful solution:
    - LSP can understand imports in the start of paragraph;
    - We can use already made solution for every language and don't write new one;
    - LSP server contains much more information than we process now. 
    E.g. it's able to show documentation of a method, reformat code, find references etc.
    
    2-3. Now every paragraph is isolated, so `a` will not be shown.
    It's made because in current implementation we can not keep connection to the server (because a lot of JVMs).
    But maybe someone has better architecture ideas how to connect zeppelin to LSP.



---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Is there any session concept in LSP ? so that multiple LSP request could belong to the same session  


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Is there any document of how to use this ? Like how to configure and start the LSP server


---

[GitHub] zeppelin pull request #3090: [ZEPPELIN-3645] Add LSP Protocol completion sup...

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 closed the pull request at:

    https://github.com/apache/zeppelin/pull/3090


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @felixcheung 
    I have added property `zeppelin.python.useLsp` which is disabled by default. It does not seem unsecured for me now. We also can specify host and port by ourselves with `zeppelin.python.lspHost` and `zeppelin.python.lspPort` properties.


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    1. Do you have any examples to show how much better LSP is compared to the current approach ?
    2. Does the auto completion works across paragraphs ? e.g. I create string variable `a` in p1, can I get correct completion in p2 ?
    3. What is the scope of LSP completion ? Is every call to LSP isolated ? 



---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Then it looks like LSP can only work in paragraph level. This seems not workable for users. Let's assume we also want to make PySpark support LSP. Then I guess if I type `sc.`, I will get nothing for completion, Because `sc` is created by zeppelin not by any paragraph. Is that correct ? 


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Solution must be improved to use by real users.


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by Tagar <gi...@git.apache.org>.
Github user Tagar commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    Very interesting improvements. Thanks for working on this. 
    Shouldn't LSP server be embedded into Python / PySpark interpreter itself and not be a separate process?
    This would address both security concerns and ability to grasp code across paragraphs like in the above example.


---

[GitHub] zeppelin issue #3090: [ZEPPELIN-3645] Add LSP Protocol completion support

Posted by oxygen311 <gi...@git.apache.org>.
Github user oxygen311 commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @zjffdu 
    If LSP has no complete for `sc.`, iPython complete will be shown.
    LSP does not support sessions, but it can keep connection.


---

[GitHub] zeppelin issue #3090: [Zeppelin-3645] Add LSP Protocol completion support

Posted by zjffdu <gi...@git.apache.org>.
Github user zjffdu commented on the issue:

    https://github.com/apache/zeppelin/pull/3090
  
    @oxygen311 I can not install it. Let me know if there any other dependency I need to install
    
    ```
    ➜  zeppelin pr/3090 ✗ pip install pyls
    Collecting pyls
      Using cached https://files.pythonhosted.org/packages/de/b7/5a056c2cac8fd19c905ae7451c2a60b9195531959c3770a49d6be4d905e3/pyls-0.1.3.zip
        Complete output from command python setup.py egg_info:
        Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
        Traceback (most recent call last):
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 143, in use_setuptools
            raise ImportError
        ImportError
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup.py", line 31, in <module>
            main()
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup.py", line 11, in main
            distribute_setup.use_setuptools()
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 145, in use_setuptools
            return _do_download(version, download_base, to_dir, download_delay)
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 124, in _do_download
            to_dir, download_delay)
          File "/private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/setup_utils/distribute_setup.py", line 193, in download_setuptools
            src = urlopen(url)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 223, in urlopen
            return opener.open(url, data, timeout)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 532, in open
            response = meth(req, response)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 642, in http_response
            'http', request, response, code, msg, hdrs)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 570, in error
            return self._call_chain(*args)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 504, in _call_chain
            result = func(*args)
          File "/Users/jzhang/anaconda3/lib/python3.6/urllib/request.py", line 650, in http_error_default
            raise HTTPError(req.full_url, code, msg, hdrs, fp)
        urllib.error.HTTPError: HTTP Error 403: SSL is required
    
        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/dp/hmchg5dd3vbcvds26q91spdw0000gp/T/pip-install-7veml3im/pyls/
    ```


---