diff --git a/packages/language-service/src/features/__fixtures__/hover.html b/packages/language-service/src/features/__fixtures__/hover.html new file mode 100644 index 0000000..5c9fd2b --- /dev/null +++ b/packages/language-service/src/features/__fixtures__/hover.html @@ -0,0 +1,3 @@ + +
+ diff --git a/packages/language-service/src/features/__fixtures__/hover.viewmodel.ts b/packages/language-service/src/features/__fixtures__/hover.viewmodel.ts new file mode 100644 index 0000000..f15b597 --- /dev/null +++ b/packages/language-service/src/features/__fixtures__/hover.viewmodel.ts @@ -0,0 +1,3 @@ +export default class { + hello = "hello"; +} diff --git a/packages/language-service/src/features/hover.spec.ts b/packages/language-service/src/features/hover.spec.ts new file mode 100644 index 0000000..df55527 --- /dev/null +++ b/packages/language-service/src/features/hover.spec.ts @@ -0,0 +1,41 @@ +import { LanguageService } from "../index.js"; +import { readFile } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; + +describe("hover", () => { + let service: LanguageService; + let fileName: string; + + beforeAll(async () => { + service = new LanguageService({ + worker: false, + }); + fileName = fileURLToPath( + new URL("__fixtures__/hover.html", import.meta.url), + ); + const text = await readFile(fileName, "utf8"); + await service.openDocument(fileName, text); + }); + + it("provides hover details for bindings (name)", async () => { + const hover = await service.getHover({ + fileName: fileName, + position: { + line: 1, + column: 17, + }, + }); + expect(hover).not.toBe(null); + }); + + it("provides hover details for viewmodel property", async () => { + const hover = await service.getHover({ + fileName: fileName, + position: { + line: 1, + column: 23, + }, + }); + expect(hover).not.toBe(null); + }); +}); diff --git a/packages/language-service/tsconfig.json b/packages/language-service/tsconfig.json index 79e5b05..84d11f3 100644 --- a/packages/language-service/tsconfig.json +++ b/packages/language-service/tsconfig.json @@ -1,7 +1,7 @@ { "references": [ - { "path": "tsconfig.lib.json" } - // { "path": "tsconfig.spec.json" } + { "path": "tsconfig.lib.json" }, + { "path": "tsconfig.spec.json" } ], "include": [] } diff --git a/packages/language-service/tsconfig.lib.json b/packages/language-service/tsconfig.lib.json index a42d6f2..efd3a03 100644 --- a/packages/language-service/tsconfig.lib.json +++ b/packages/language-service/tsconfig.lib.json @@ -1,4 +1,5 @@ { "extends": ["@tools/tsconfig/node.json"], - "include": ["src"] + "include": ["src"], + "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "**/__fixtures__"] }