Skip to content

Commit 8ee8018

Browse files
committed
chore(clangd_lsp): plumb through verbose logging
1 parent 6d87ca1 commit 8ee8018

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

clangd_lsp.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,17 @@ def parse_includes_from_diagnostics(
157157

158158
# Partially based on sansio-lsp-client/tests/test_actual_langservers.py
159159
class ClangdClient:
160-
def __init__(self, clangd_path: str, root_path: pathlib.Path, compile_commands_dir: pathlib.Path = None):
160+
def __init__(
161+
self,
162+
clangd_path: str,
163+
root_path: pathlib.Path,
164+
compile_commands_dir: pathlib.Path = None,
165+
log_level: str = None,
166+
):
161167
self.root_path = root_path
162168
self.clangd_path = clangd_path
163169
self.compile_commands_dir = compile_commands_dir
170+
self.log_level = log_level
164171
self.lsp_client = AsyncSendLspClient(
165172
root_uri=root_path.as_uri(),
166173
trace="verbose",
@@ -230,6 +237,9 @@ async def _log_stderr(self):
230237
async def start(self):
231238
args = ["--enable-config", "--background-index=false", f"-j={get_worker_count()}"]
232239

240+
if self.log_level:
241+
args.append(f"--log={self.log_level}")
242+
233243
if self.compile_commands_dir:
234244
args.append(f"--compile-commands-dir={self.compile_commands_dir}")
235245

suggest_include_changes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ async def start_clangd_client():
195195
args.clangd_path,
196196
root_path,
197197
args.compile_commands_dir.resolve() if args.compile_commands_dir else None,
198+
log_level="verbose" if args.verbose else None,
198199
)
199200
await clangd_client.start()
200201

0 commit comments

Comments
 (0)