7

Recently LSP has stopped working for me.

I'm getting this message for all files in my project.

LSP :: example_filename.c not in project or it is blacklisted.

How can I investigate this, if it's blacklisted, how can I reset the blacklist?

3
  • LSP is a protocol so it neither works nor can stop working. You're presumably talking about some implementation of this protocol, so please say which implementation you're using (probably lsp-mode or eglot on Emacs's side, and some LSP server on the other side but I can't begin to guess about that other side).
    – Stefan
    Dec 17, 2019 at 15:32
  • The question is tagged lsp-mode, but I could have included that in the title (will edit).
    – ideasman42
    Dec 17, 2019 at 23:37
  • 2
    I had to manually add the folder to the workspace by lsp-workspace-folders-add
    – capitrane
    Feb 3, 2021 at 9:08

3 Answers 3

12

I somehow managed to blacklist my own project, removing .lsp-session-v1 resolved the issue.

This could be located in either:

  • ~/.emacs.d/.lsp-session-v1
  • ~/.config/emacs/.lsp-session-v1

Although I might have been able to solve this using lsp-workspace-blacklist-remove

3
  • I don't have folder name called ~/.emacs.d/.lsp-session-* could it be located in somewhere else?
    – alper
    Mar 22 at 9:20
  • Updated answer to show two possible locations.
    – ideasman42
    Mar 22 at 10:41
  • I was able to find a file called ~/var/lsp/session.el , could it be the related file?
    – alper
    Mar 22 at 11:25
2

@capitrane comment had the answer for me: M-x lsp-workspace-folders-add from within the project, and it started to work.

4
  • Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. - From Review
    – erikstokes
    Jun 16, 2021 at 23:02
  • 1
    There was no such answer -- it was an old comment which deserves to be an answer. Jun 17, 2021 at 21:15
  • 1
    But you shouldn't just copy the comment: make it useful for naive users. E.g. I don't know much about lsp, so I have no idea whether what you quote is a function or a variable. I also have no idea how exactly to call the function/set the variable to add the folder. I can guess and I know how to get around the docs to figure out how to use it, but a noob might not. So by all means, credit @capitrane, make his/her comment an answer, but don't just copy the comment: you spent some time to make it work for you, so explain it in enough detail to enable a naive user to use it.
    – NickD
    Jun 25, 2021 at 14:16
  • Answer updated appropriately. Jul 6, 2021 at 17:17
0

M-x lsp works for me. ("Entry point for the server startup.")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.