reddit / emacs

lsp mode issues

timmymayes · 2022-04-26 14:44
I'm following the emacs from scratch series from system crafters and I'm on #8 "Build your own ide with lsp-mode" In it we're walked through setting up typescript for lsp (theia-ide) and the company package for better completions. My setup code block is at the bottom and my lsp log for some reference. I open a typescript test file to see if lsp is auto loading and if its actually working. I get some sort of scanning animation on the far right of my bar with no indication of what it is but its only in lsp mode. You can see one frame of animation from this line pulled from my buffer list. Sometimes instead there is no scan line. My two main issues are 1. i have no clue what the scanning is 2. lsp doesn't seem to autoload when I open a TypeScript File 3. I also tried setting up lsp for html but 1. when i turn on lsp mode in an html file i get completions from my TypeScript file. 2. In my buffer list i have a ts-ls buffer and a ts-ls::stderr but nothing for html. Granted I'm quite new so maybe this is intended functionality. &#x200B; * test.ts 9 TypeScript| █| ~/Projects/emacsone/OrgFiles/test.ts &#x200B; ** Languages *** Language Server #+begin_src emacs-lisp (use-package lsp-mode :commands (lsp lsp-deffered) :init (setq lsp-keymap-prefix "C-c l") :config (lsp-enable-which-key-integration t)) #+end_src #+RESULTS: *** TypeScript #+begin_src emacs-lisp (use-package typescript-mode :mode "\\.ts\\'" :hook (typescript-mode . lsp-deferred) :config (setq typescript-indent-level 2)) #+end_src * Better Completions #+begin_src emacs-lisp (use-package company :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)) #+end_src My LSP Log has the following Command "/home/tyler/.emacs.d/.cache/lsp/npm/typescript-language-server/bin/typescript-language-server --tsserver-path /usr/local/bin/tsserver --stdio" is present on the path. Command "deno lsp" is not present on the path. Found the following clients for /home/tyler/Projects/emacsone/OrgFiles/test.ts: (server-id ts-ls, priority -2) The following clients were selected based on priority: (server-id ts-ls, priority -2)
ahjarrett · 2022-08-01 21:34
Not sure if you ever fixed this, but I ran into this issue on a new machine and was totally confused. Eventually installing the language server and typescript globally fixed it for me -- sharing in case this is helpful (probably not by now): `npm i -g typescript-language-server typescript`
timmymayes · 2022-08-01 21:45
It randomly started working. But I appreciate you dropping a solution.
Available-Bug8339 · 2022-08-24 15:55
u/timmymayes what config do you - I have the same exact issue - i'm thinking it has something to do with my using nvm.
timmymayes · 2022-08-24 16:02
I used this blog to setup: [https://www.chadstovern.com/javascript-in-emacs-revisited/](https://www.chadstovern.com/javascript-in-emacs-revisited/) It started working one day (i decided to not worry about it as I was learning webdev and didn't need the lsp stuff and one day I was doing js stuff and it was working ...not sure why)
Available-Bug8339 · 2022-09-15 19:25
Just a follow-up - I too never got to the bottom of this - and it started working for me one day too lol ....sooo we win I guess?
timmymayes · 2022-09-15 19:34
Yes yes we do.