fix(php): document language constructs and clarify rename failures (#354)

PHP language constructs such as empty and isset had no completion documentation, hover or quick documentation because the language server reports them as plain keywords. They now get built-in documentation in completion, hover, quick documentation and Go to Declaration (which shows the docs instead of failing), without matching strings, comments, methods or other languages. A refused syntax-based rename now states why the language server couldn't rename first.

Closes #340
Refs #221
This commit is contained in:
l0ng-ai authored and GitHub committed 2026-10-30 19:46:08 +08:00
1 parent bc70ec7028
commit b2c183dbd4
10 files changed
+195 -10

No files matched your search

+18
View File
@@ -350,6 +350,24 @@ describe("navigation wiring", () => {
});
describe("rename wiring", () => {
it("preserves the server's missing capability when syntax cannot rename a method", async () => {
cmd.lspPrepareRename.mockReturnValueOnce(
Promise.resolve({
status: "error",
error: { kind: "unavailable", message: "intelephense doesn't support rename" },
}),
);
cmd.syntaxLocals.mockReturnValueOnce(ok({ status: "notLocal", name: "run", range: r(0, 4, 7), reason: "member" }));
const view = editor("obj.run();", "php", 5);
await startRename(view);
const message = document.querySelector(".cm-lsp-hint")?.textContent;
expect(message).toContain("intelephense doesn't support rename");
expect(message).toContain("only local variables");
expect(message).not.toContain("without the language server");
expect(view.state.doc.toString()).toBe("obj.run();");
expect(useLspPopup.getState().popup).toBeNull();
});
it("renames a certain local in place when the server is not ready", async () => {
cmd.syntaxLocals.mockReturnValueOnce(ok(local({ references: [r(1, 4, 5)] })));
cmd.syntaxNodeAt