Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with LSP by generating compile_commands.json #213

Open
lungsin opened this issue Jan 12, 2025 · 0 comments
Open

Integration with LSP by generating compile_commands.json #213

lungsin opened this issue Jan 12, 2025 · 0 comments

Comments

@lungsin
Copy link

lungsin commented Jan 12, 2025

tcframe script directly invoke g++ and uses custom include paths -I "$TCFRAME_HOME/include". This causes a bunch of errors to the code editor that uses LSP with default config:

image

One solution is to generate compile_commands.json to tell the LSP how the compilation is done. For example, the following is a compile_commands.json that I handcraft for my own usage (with /absolute/bath/to/working/directory replaced).

[
  {
    "directory": "/absolute/path/to/working/directory",
    "command": "g++ -std=c++17 -D__TCFRAME_SPEC_FILE__=\"\\\"/absolute/path/to/working/directory/spec.cpp\\\"\" -I \"/home/klungs/tcframe/include\" -O2 -o \"runner\" \"/home/klungs/tcframe/src/tcframe/runner.cpp\"",
    "file": "/home/klungs/tcframe/src/tcframe/runner.cpp"
  }
]

My proposal is to have tcframe script to generate compile_commands.json, e.g. using command tcframe export_compile_commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant