List of functions in Python script being edited in Kate?
SecretCode
secretcode343 at gmail.com
Thu Jul 15 23:59:30 BST 2021
I haven't begun to explore using it, but I did the following:
sudo pip install python-language-server
In Kate, enable 'LSP Client' plugin
Now if I open a .py file and right-click on a variable I get an lsp
client submenu with things like go to definition, and highlight
(highlighting was a bit slow).
So for basic usage of the default lsp server - seems pretty easy to set up.
Joe
On 15/07/2021 20:00, Waqar Ahmed wrote:
> Hi,
>
> Setting up an LSP is fairly straightforward but can be a bit daunting
> the first time you do it. Kate already handles the "LSP" config for
> you (in most cases).
>
> For python, you need pyls. Since you already have it, you can verify
> whether it starts by enter on the command line:
>
> pyls
>
> if that executes, congrats, you have a working python language server.
> There is nothing more to it really.
>
> Now when you open a python file, Kate will automatically start the LSP
> for you. To test whether it is actually working, try the
> autocompletion and write somethiing. If the autocompletion items have
> "[]" (square brackets) in the end, your lsp is working fine.
> Additionally you can try to "Ctrl + Click" on some symbol and see
> whether it takes you to the symbols definition.
>
> There are other servers for python, like Microsofts python server and
> some more. You can experiment with those yourself and ask for help if
> it doesn't work. How would you configure a new server? Well, you can
> start by looking at the config in "Kate -> Configure Kate -> LSP ->
> Default Server Settings". Its usually just adding the executable, but
> sometimes there's a little more to it.
>
> Also, we have a help page for LSP settings in Kate Help which you can
> explore it here:
> https://docs.kde.org/stable5/en/kate/kate/kate-application-plugin-lspclient.html
>
> On Thu, Jul 15, 2021 at 10:58 PM Tony Dunn <tonydunn at protonmail.com> wrote:
>> I've never managed to get a LSP for any language working with Kate, and would welcome someone with a working config for (say) Python sharing that for instructional purposes.
>>
>> I got pyls and everything else from pypi and did pip3 install 'python-language-server[all]' so the whole collection of flake8, pycodestyle etc were installed, but the docs are a bit too vague (for me) to extract what needs to be done with the LSP config so Kate can connect and take advantage of what the LSP can do.
>>
>> Thanks
>>
>> Tony
>>
>> Sent with ProtonMail Secure Email.
>>
>> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>> On Monday, July 12th, 2021 at 21:44, SecretCode <secretcode343 at gmail.com> wrote:
>>
>> Thank you! Symbol Viewer does a great job - classes, method and global functions are all recognised and can be navigated to.
>>
>> This is all I need, but it sounds like LSP could offer more - however, I get a (repeated) warning flashing up:
>> LSP Client: Server terminated unexpectedly: python3 -m pyls --check-parent-process
>>
>> I presume I need to install the pyls module to provide this language server, but I can't work out where to get hold of it.
>>
>>
>> Joe
>>
>> On 12/07/2021 19:14, Waqar Ahmed wrote:
>>
>> Hi,
>>
>> Yes, there are multiple ways to do that. In settings - plugins, enable "Symbol Viewer".
>>
>> I am not sure if supports python, but if it does you will have symbols listed in a tool view.
>>
>> However, The best way to do this is via "LSP plugin". Set up a python language server, and it will provide you with intelligent auto completion, go to definition and other IDE like features.
>>
>> A third way to do it is via our CTags plugin.
>>
>> On Mon, Jul 12, 2021, 9:54 PM SecretCode <secretcode343 at gmail.com> wrote:
>>> Hi, first post to the list!
>>>
>>> One thing I'd really like to improve my use of Kate as a Python code editor is the ability to list all the functions and/or classes in the current script / module, for example in a tool view panel. As most IDE editors provide!
>>>
>>> I'm sure this capability must exist but I have not been able to find it ... is there such a thing? Possibly as a plugin?
>>>
>>> Thanks - Joe
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20210715/895b37f4/attachment-0001.htm>
More information about the KWrite-Devel
mailing list