20 lines
594 B
Python
20 lines
594 B
Python
"""clangd adapter."""
|
|
|
|
from ..workspace import find_root
|
|
|
|
|
|
class Clangd:
|
|
name = "clangd"
|
|
extensions = [".c", ".h", ".cc", ".cpp", ".cxx", ".hpp", ".hxx"]
|
|
root_markers = ["compile_commands.json", "compile_flags.txt", ".clangd", "CMakeLists.txt", "Makefile"]
|
|
cmd = ["clangd", "--background-index"]
|
|
|
|
def initialization_options(self):
|
|
return {}
|
|
|
|
def workspace_root(self, filepath: str, fallback: str | None = None) -> str:
|
|
return find_root(filepath, self.root_markers, fallback)
|
|
|
|
def prepare_open(self, filepath: str) -> dict | None:
|
|
return None
|