[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with python ide
From: |
Samuel Banya |
Subject: |
Re: Help with python ide |
Date: |
Thu, 28 Apr 2022 08:30:32 -0400 |
User-agent: |
Cyrus-JMAP/3.7.0-alpha0-591-gfe6c3a2700-fm-20220427.001-gfe6c3a27 |
You would have to a little bit more specific in terms of the file types that
you want to work in this scenario.
The idea is that you can limit the file types in your config so that when you
open a specific file, let's say, a '.py' file, you could cause LSP Mode to be
activated.
I use LSP mode as well, but actually am having issues with it fighting with
'aggressive-indent' mode, so mine's not the best for this, but I'm willing to
share mine to give you an idea of it.
My full config can be found here:
*
https://github.com/SamuelBanya/dotfiles/blob/main/emacs/.emacs.d/configuration.org
That being said, my config does have LSP Mode engaged within the ':hook'
statements when appropriate for 'use-package' for each mode.
Here's my portion of my LSP based config
(defun ef/lsp-mode-setup ()
;; Taken from this 'System Crafters' video:
;; https://www.youtube.com/watch?v=E-NAM9U5JYE
;; This allows breadcrumb segments to appear in projects
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred)
;; Taken from this page:
;; https://www.mattduck.com/lsp-python-getting-started.html
:init
(setq lsp-keymap-prefix "C-c l")
:config
(lsp-enable-which-key-integration t)
;; Set 'lsp-idle-delay' to 0.5 seconds for quick autocompletion
(setq lsp-idle-delay 0.5))
(use-package typescript-mode
:ensure t
:mode ("\\.ts\\'" "\\.tsx\\'")
:hook (typescript-mode . lsp-deferred)
:config
(setq typescript-indent-level 2))
(use-package company
:ensure t
:after lsp-mode
:hook (lsp-mode . company-mode)
:bind (:map company-active-map
("<tab>" . company-complete-selection))
(:map lsp-mode-map
("<tab>" . company-indent-or-complete-common))
:custom
(company-minimum-prefix-length 1)
(company-idle-delay 0.0))
Here's a good video on setting up LSP Mode by the way, would recommend to check
this out (don't just copy and paste, but follow along with since you might not
want everything:
https://www.youtube.com/watch?v=E-NAM9U5JYE
Hope this helps a small bit :)
Sincerely,
Sam
On Thu, Apr 28, 2022, at 7:47 AM, Neal Becker wrote:
> I've been using emacs since 1980s and python for about as long as it's
> existed. While I get by, I'd like some more modern ide features. I've read
> about lsp and eglot. I'm trying out eglot and it seems nice for python mode
> source files. But I also want support in python shell mode. Specifically,
> after starting a python shell (e.g., in python mode with eglot there is a
> top menu python/interpreter/python3) we now have an buffer for interactive
> python, but no help for eglot. I'd like to at least have completions.
>
> It seems if I add
> (add-hook 'after-init-hook 'global-company-mode)
>
> now I have completions in python shell mode. These completions seem
> minimal, no way I can see to get documentation (eldoc).
>
> Long story short: any simple way to get a modern ide for python that
> supports both usage in the python source file and support for completions
> and documentation in python shell?
>
> Note: In the past I've used ipython3 for python shell and then you can
> always get doc by typing "symbol?". It seems ipython3 isn't working when
> started from python/interpreter/ipython3. Instead the cursor jumps
> erratically to some tmp buffer and displays error messages.
>
> Thanks,
> Neal
>
>
>
>