Community
    • Login

    Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?

    Scheduled Pinned Locked Moved General Discussion
    38 Posts 7 Posters 9.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EkopalypseE
      Ekopalypse @Michael Vincent
      last edited by

      @Michael-Vincent

      it should be slow only for the first time it discovers an object. If you use certain objects more often
      then others, you could try to preload them jedi.preload_module(['os','sys', ...])

      Michael VincentM 1 Reply Last reply Reply Quote 1
      • Michael VincentM
        Michael Vincent @Ekopalypse
        last edited by

        @Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:

        preload them jedi.preload_module([‘os’,‘sys’, …])

        Thanks for the tip! Python is obviously not my strength; hence, the want for some “IDE-lite” help from Notepad++.

        Cheers.

        EkopalypseE 1 Reply Last reply Reply Quote 1
        • EkopalypseE
          Ekopalypse @Michael Vincent
          last edited by

          @Michael-Vincent

          :-D - the same would happen to me if I try to write perl :-D

          1 Reply Last reply Reply Quote 1
          • TroshinDVT
            TroshinDV
            last edited by

            @pidgeon777 said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:

            Microsoft Language Server Protocol (LSP) defines the protocol used between an editor or IDE and a language server that provides language features like autocomplete, go to definition, find all references etc.:

            Screenshot_270.png
            У меня есть немного для php, js, vbs, 1C, MySql.
            https://github.com/trdm/jn-npp-scripts

            1 Reply Last reply Reply Quote 0
            • Michael VincentM
              Michael Vincent @Ekopalypse
              last edited by

              @Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:

              ok, this is my “lsp” script (called python_ide.py)

              I wonder if this pylspclient can be used? It’s supposedly an LSP client written in Python so theoretically PythonScript could run it.

              I’ve been playing with it from the command line with my system Python3 and not having much luck with the examples/python-language-server.py script included and having the python-language-server installed.

              Cheers.

              EkopalypseE 2 Replies Last reply Reply Quote 1
              • EkopalypseE
                Ekopalypse @Michael Vincent
                last edited by

                @Michael-Vincent

                let me have a look and play with it a bit.

                1 Reply Last reply Reply Quote 1
                • EkopalypseE
                  Ekopalypse @Michael Vincent
                  last edited by Ekopalypse

                  @Michael-Vincent

                  It looks like the main problem might be that this lspclient is written for Python2.
                  Let me see if I can make a working version. Probably in 6-7 hours.

                  Michael VincentM 1 Reply Last reply Reply Quote 0
                  • Michael VincentM
                    Michael Vincent @Ekopalypse
                    last edited by

                    @Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:

                    lspclient is written for Python2

                    Weird - it seems to “run” OK - not throwing any errors, but just not initializing with the language server:

                    PS VinsWorldcom ~\source\personal\pylspclient\examples > python3 .\python-language-server.py
                    2020-12-02 10:19:26,251 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'autopep8': No module named 'pycodestyle'
                    
                    2020-12-02 10:19:26,297 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'pycodestyle': No module named 'pycodestyle'
                    
                    2020-12-02 10:19:26,301 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'pydocstyle': No module named 'pydocstyle'
                    
                    2020-12-02 10:19:26,492 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'rope_completion': No module named 'rope'
                    
                    2020-12-02 10:19:26,496 UTC - WARNING - pyls.config.config - Failed to load pyls entry point 'rope_rename': No module named 'rope'
                    
                    {'capabilities': {'codeActionProvider': True, 'codeLensProvider': {'resolveProvider': False}, 'completionProvider': {'resolveProvider': False, 'triggerCharacters': ['.']}, 'documentFormattingProvider': True, 'documentHighlightProvider': True, 'documentRangeFormattingProvider': True, 'documentSymbolProvider': True, 'definitionProvider': True, 'executeCommandProvider': {'commands': []}, 'hoverProvider': True, 'referencesProvider': True, 'renameProvider': True, 'foldingRangeProvider': True, 'signatureHelpProvider': {'triggerCharacters': ['(', ',', '=']}, 'textDocumentSync': {'change': 2, 'save': {'includeText': True}, 'openClose': True}, 'workspace': {'workspaceFolders': {'supported': True, 'changeNotifications': True}}, 'experimental': {}}}
                    init =  None
                    

                    NOTE: I made 2 small changes to the the examples/python-language-server.py script:

                    diff --git a/examples/python-language-server.py b/examples/python-language-server.py
                    index 72026e5..0e67858 100644
                    --- a/examples/python-language-server.py
                    +++ b/examples/python-language-server.py
                    @@ -19,7 +19,7 @@ class ReadPipe(threading.Thread):
                                 line = self.pipe.readline().decode('utf-8')
                    
                     if __name__ == "__main__":
                    -    pyls_cmd = ["python", "-m", "pyls"]
                    +    pyls_cmd = ["python3", "-m", "pyls"]
                         p = subprocess.Popen(pyls_cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                         read_pipe = ReadPipe(p.stderr)
                         read_pipe.start()
                    @@ -143,7 +143,7 @@ if __name__ == "__main__":
                         root_uri = 'file:///path/to/python/project'
                         workspace_folders = [{'name': 'python-lsp', 'uri': root_uri}]
                         print(lsp_client.initialize(p.pid, None, root_uri, None, capabilities, "off", workspace_folders))
                    -    print(lsp_client.initialized())
                    +    print("init = ", lsp_client.initialized())
                    
                         lsp_client.shutdown()
                         lsp_client.exit()
                    

                    Cheers.

                    1 Reply Last reply Reply Quote 0
                    • EkopalypseE
                      Ekopalypse
                      last edited by

                      @Michael-Vincent - I tried to make it work but after three
                      Npp crashes I decided to make my implementation work with python3.
                      I’ll keep working on it an updates will be made available via the github repo.

                      Michael VincentM 1 Reply Last reply Reply Quote 2
                      • Michael VincentM
                        Michael Vincent @Ekopalypse
                        last edited by

                        @Ekopalypse said in Microsoft Language Server Protocol (LSP): A possible revolution for Notepad++?:

                        I’ll keep working on it an updates will be made available via the github repo.

                        I’ll keep checking back then - thanks!

                        pidgeon777P 1 Reply Last reply Reply Quote 1
                        • pidgeon777P
                          pidgeon777 @Michael Vincent
                          last edited by

                          A plugin implementing an LSP client in Notepad++ has finally been released.

                          https://github.com/Ekopalypse/NppLspClient

                          Credits to @Ekopalypse for that.

                          I encourage everyone to give it a try and report back for any found issue.

                          EkopalypseE 1 Reply Last reply Reply Quote 2
                          • EkopalypseE
                            Ekopalypse @pidgeon777
                            last edited by

                            … but bear in mind that this is in an early alpha stage and that there is another plugin that already covers some pitfalls when it comes to implementing LSP for Npp and Scintilla.

                            1 Reply Last reply Reply Quote 2
                            • Michael VincentM Michael Vincent referenced this topic on
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors