When opening a Java file of a project previously attached to lsp-mode and the language server, the modeline as well as the error buffer called up with s-l g e show errors of all projects I ever attached to the language server.
Is it possible to avoid this? As long as I don't open a Java file from some other project, I would prefer to work as if the project of the file I am looking at is the only project I have.
To elaborate: my preferred setup would be to have separate emacs server processes taking care each of one project at a time. Despite editing or viewing source code in several projects, seeing something like 3 warnings in the modeline when its actually zero for the project I am focusing on whereas the 3 are from another project I am only skimming the source code of is distracting and confusing.
EDIT: "separate emacs processes" was a typo from day one in this question. It should have been "separate server processes" or just don't mix/merger the errors of multiple projects.
add-advicewith:aroundparameter (you can see an example here) tolsp-modeandlspfunctions, where you'd simply avoid calling the original function if an lsp-server is running and its project dir does not accord to the file you're opening. That said,there may be an easier way. E.g. Idk what do you mean "projects attached", is that some built-in functional in lsp-mode? I usually use.dir-locals.els for projects where I wantlspto run automatically..javafile triggers start of the eclipse language server which then looks at its workspace directory (~/.emacs.d/workspace by default) where to either create or find metadata for the project of the opened Java file. If there is metadata from other Java projects, they are all opened and "processed", including sending errors/warnings found to the emacs lsp client. So maybe it is more of an eclipse language server thing I am trying to avoid here :-/ I might look more closely at whats-l F rremove folder does, but that would be a manual step each time..javafile does not triggerlsp-mode, so no servers is being started. In general, for melsp-modeonly starts automatically when there's a.dir-locals.elfile at the top dir of the project that explicitly runs(lsp). So I presume you have some local settings that triggerlsp-modeupon opening the file. By any chance, do you use Doom Emacs? They provide a lot of pre-configured things, so it might just be part of their customization.