manateelazycat / lsp-bridge

A blazingly fast LSP client for Emacs
GNU General Public License v3.0
1.46k stars 212 forks source link

lsp-bridge not recognizing org-src python buffer #1028

Open hsanter opened 2 months ago

hsanter commented 2 months ago

GNU Emacs 28.0.50 (build 1, aarch64-apple-darwin20.5.0, NS appkit-2022.50 Version 11.4 (Build 20F71)) of 2021-07-19

  (add-to-list 'load-path "/Users/aosc/.emacs.d/elpa/lsp-bridge/lsp-bridge")

  (require 'yasnippet)
  (yas-global-mode 1)

  (require 'lsp-bridge)
  ;; (global-lsp-bridge-mode)
  (setq lsp-bridge-enable-diagnostics nil)
  (define-key acm-mode-map (kbd "C-j") 'acm-select-next) 
  (define-key acm-mode-map (kbd "C-k") 'acm-select-prev)

...

  (add-hook 'elpy-mode-hook 'lsp-bridge-mode)

lsp-bridge correctly turns on when opening a .py file. The following gets logged in Messages buffer the first time file is opened:

[LSP-Bridge] found language server: /Users/aosc/opt/anaconda3/bin/basedpyright-langserver [LSP-Bridge] Active file '.py’, enjoy hacking!

Screen Shot 2024-09-03 at 2 49 17 PM

However, when opening an org-src block with C-c ', I do not get that message and do not get any python-specific completion suggestions:

Screen Shot 2024-09-03 at 2 58 24 PM

Is this normal behavior? If so, is there a way to enable lsp-bridge to recognize python major-mode buffers created from C-c '?

Thank you!

manateelazycat commented 2 months ago

You can got completion in org-src block directly, don't need C-c C-c

hsanter commented 2 months ago

How do I do this? By default the only completions I get within src-blocks are for dictionary words at the moment with only the config above as far as lsp-bridge goes. No language-specific suggestions happen. Screen Shot 2024-09-05 at 2 20 15 PM

manateelazycat commented 2 months ago

Move cursor to org-src block, and check lang-name in https://github.com/manateelazycat/lsp-bridge/blob/8d0e32effab5a4fee2c7d76886cd4a62bad96449/lsp-bridge-org-babel.el#L67

hsanter commented 2 months ago

lang-name in that function is being set to nil right now based on running M-x debug-on-entry for that function and then running it with cursor in the python org src-block.

My org-src-lang-modes does contain ("python" . python) which I believe is appropriate.

Evaluating (org-element-property :language lsp-bridge-org-babel--info-cache) by itself with cursor in the src-block also returns nil.

manateelazycat commented 2 months ago

Can you try emacs -Q and only load lsp-bridge for test?