help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions Regarding LSP Mode For Emacs


From: Samuel Banya
Subject: Questions Regarding LSP Mode For Emacs
Date: Tue, 11 Jan 2022 13:26:27 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4569-g891f756243-fm-20220111.001-g891f7562

Hey there,

I have been trying to incorporate LSP Mode for Emacs to work both on my Linux 
computers, and my work based Macbook Pro.

The problem is that I don't really see any of the related modes actually 
working, so I'm wondering if anyone could provide some related advice on how to 
set up LSP mode easily.

*NOTE: *
 * I wanted to stick all of the language servers into the '~/.emacs.d/' based 
directory since I don't want to have to search all over for them on a given 
machine to see if there are any issues.
*
*
*This is a portion of my Emacs config on this topic, the entire config can be 
found here, 
'*https://git.musimatic.xyz/dotfiles/tree/emacs/.emacs.d/configuration.org*':*
*** Add 'lsp-mode' for better autocompletion for many programming languages 
(python, ruby, java, C++)
#+begin_src emacs-lisp
  (use-package lsp-mode
    :ensure t
    ;; Taken from this page:
    ;; https://www.mattduck.com/lsp-python-getting-started.html
    :hook
    ;; List of modes taken from here:
    ;; https://kb.iu.edu/d/acyg
    ((js-mode
      js-jsx-mode
      typescript-mode
      web-mode
      python-mode
      ruby-mode
      C++-mode
      java-mode
      php-mode
      elixir-mode
      go-mode
      csharp-mode))
    :config
    ;; Set 'lsp-idle-delay' to 0.5 seconds for quick autocompletion
    (setq lsp-idle-delay 0.5)
    ;; Set the 'lsp-server-install-dir' variable so that lsp servers are 
installed in ~/.emacs.d: 
    (setq lsp-server-install-dir (concat user-emacs-directory "lsp-servers")))
#+end_src

*CONTINUED:*
 * The most specific example of it not working is with 'java' based files on 
the Macbook for example:

*- This is to fix this error message when opening up a Java file in Emacs with 
'lsp-mode':*
#+begin_src text
LSP :: There are no language servers supporting current mode `java-mode' 
registered with `lsp-mode'.
This issue might be caused by:
1. The language you are trying to use does not have built-in support in 
`lsp-mode'. You must install the required support manually. Examples of this 
are `lsp-java' or `lsp-metals'.
2. The language server that you expect to run is not configured to run for 
major mode `java-mode'. You may check that by checking the `:major-modes' that 
are passed to `lsp-register-client'.
3. `lsp-mode' doesn't have any integration for the language behind `java-mode'. 
Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and 
https://langserver.org/ .
4. You are over `tramp'. In this case follow 
https://emacs-lsp.github.io/lsp-mode/page/remote/.
5. You have disabled the `lsp-mode' clients for that file. (Check 
`lsp-enabled-clients' and `lsp-disabled-clients').
Quit
#+end_src
- <2021-11-10 Wed 13:50>: Did this just now, but its complaining with this 
error:
#+begin_src text
File mode specification error: (error Autoloading file 
/Users/samuelbanya/.emacs.d/elpa/lsp-java-20211109.632/dap-java.elc failed to 
define function lsp-java)
#+end_src

*CONTINUED:*
 * If anyone could provide advice on this, I would appreciate it :)
 * My main goal would be to somehow get the following languages supported by 
LSP:
   * Python
   * Ruby
   * JS
   * Typescript
   * Bash

Thanks,

Sam


reply via email to

[Prev in Thread] Current Thread [Next in Thread]