дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
fix(cpp): explain missing clang-tidy checks with Apple's clangd (#770)
Apple's clangd (/usr/bin/clangd, Xcode and CommandLineTools toolchains) is built without clang-tidy, so on a Mac without a managed clangd the checks from .clang-tidy never appear. When a clangd server for C, C++, Objective-C or Objective-C++ resolves to Apple's binary and the project has a .clang-tidy, show one warning per session with Install (managed LLVM clangd, which already takes precedence once installed) and Language Servers… actions. Fixes #692.
Цей коміт міститься в:
1 джерело
ff97d7724c
коміт
e2f8e8d5bc
11 files changed
+331
-5
No files matched your search
@@ -7,7 +7,7 @@ import { useTasks } from "@/workbench/tasks";
|
||||
import { MemoryToolsBackend, sampleTools, setToolsBackend } from "../backend";
|
||||
import { cancelInstall, installTool, refreshTools, uninstallTool, useTools } from "../store";
|
||||
import { filterTools, LanguageServersPage } from "../LanguageServersPage";
|
||||
import { installMissingServerPrompts, missingKey, promptInstall } from "../missing";
|
||||
import { installMissingServerPrompts, installServerWarningPrompts, missingKey, promptInstall } from "../missing";
|
||||
import { resetTestForm, stagedFor, TestSettingsForm } from "./settingsForm";
|
||||
|
||||
type Note = Parameters<NotificationService["notify"]>[0];
|
||||
@@ -273,3 +273,49 @@ describe("tools.install action", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("language server capability warning", () => {
|
||||
const event = {
|
||||
type: "languageServerWarning",
|
||||
name: "clangd",
|
||||
message:
|
||||
"Apple's clangd does not run clang-tidy, so checks from .clang-tidy are not shown. Install clangd (LLVM) to get them.",
|
||||
installTool: "clangd",
|
||||
} as const;
|
||||
|
||||
it("offers a managed replacement for system clangd once and restarts it after installation", async () => {
|
||||
backend.tools.push({
|
||||
...sampleTools()[0]!,
|
||||
name: "clangd",
|
||||
displayName: "clangd",
|
||||
command: "clangd",
|
||||
status: "onPath",
|
||||
path: "/usr/bin/clangd",
|
||||
languages: ["C", "C++", "Objective-C", "Objective-C++"],
|
||||
});
|
||||
const off = installServerWarningPrompts();
|
||||
try {
|
||||
emitLocalIdeEvent(event);
|
||||
emitLocalIdeEvent(event);
|
||||
await waitFor(() => expect(notes).toHaveLength(1));
|
||||
expect(notes[0]).toMatchObject({ title: "clangd", level: "warning", sticky: true, body: event.message });
|
||||
expect(notes[0]!.actions!.map((a) => a.label)).toEqual(["Install", "Language Servers…"]);
|
||||
notes[0]!.actions![0]!.run();
|
||||
await waitFor(() => expect(backend.restarted).toEqual(["clangd"]));
|
||||
expect(notes.at(-1)).toMatchObject({ title: "clangd installed", key: notes[0]!.key });
|
||||
} finally {
|
||||
off();
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps the Settings action when the tool cannot be installed", async () => {
|
||||
const off = installServerWarningPrompts();
|
||||
try {
|
||||
emitLocalIdeEvent(event);
|
||||
await waitFor(() => expect(notes).toHaveLength(1));
|
||||
expect(notes[0]!.actions!.map((a) => a.label)).toEqual(["Language Servers…"]);
|
||||
} finally {
|
||||
off();
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Заблокувати користувача