0

I'm trying to use eglot on gem5, but I've noticed that I need to specify the analysis directory as src/python, and I understand that it seems to be possible to set this by setting eglot-workspace-configuration, but I'm not sure how to go about this.

1 Answer 1

0

As far as I can find here, you can use 'project.el facilities' to set the root dir for an 'eglot project'. Then, the initial comment of the project.el file mentions that the VCS project type can also be used for 'non-VCS controlled directories' via the project-vc-extra-root-markers variable (refer to its docstring for more info).

So I would advise you to try creating a .dir.locals.el file in that src/python directory containing:

((nil . ((project-vc-extra-root-markers ".dir-locals.el"))))

As you are creating the .dir-locals.el file anyway, you can also immediately use it as a project-vc-extra-root-markers, but you could use some other marker (i.e. filename in the src/python dir) also.

Now visit a file in the src/python directory and do M-: (project-root) to see if the new project root directory is recognized. If not, then try again after restarting Emacs (restarting will clear the vc-file-prop-obarray 'cache').

If the previous step returns the 'correct' project root dir, then start eglot. I hope now eglot indeed uses this project root as your 'analysis dir'. Good luck!

1
  • Thank you for your answer, I recently found out that in gem5 projects there are both cpp and python languages, and simply using src/python as the project directory causes clangd to fail, and I wanted to ask if there's any other way to make python lsp analyze only the src/python directory
    – Thysrael
    Dec 29, 2023 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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