mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 00:44:27 +00:00
Modules are known by their file: import button from ui/menu.fch and import ui/button are one module, two util.fch are two; min/max/abs/clamp win over C's int-only abs; completion after an import's other name; hover docs; engineers' guides
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016GzNP6r8dg6WDxUVZy8wjL
This commit is contained in:
parent
17863ecf7b
commit
3ba2dcd5d6
16 changed files with 152 additions and 18 deletions
|
|
@ -186,6 +186,19 @@ c.notify("textDocument/didChange", {"textDocument": {"uri": uri2, "version": 4},
|
|||
diags = c.diagnostics(uri2)
|
||||
check("error: unhandled failure", diags and "can fail" in diags[0]["message"], diags)
|
||||
|
||||
# a module imported under another name: completion after its name
|
||||
src3 = "import path as pt\n\nfn main() {\n print(pt.base(\"a/b\"))\n}\n"
|
||||
path3 = os.path.join(d, "alias.fch")
|
||||
open(path3, "w").write(src3)
|
||||
uri3 = pathlib.Path(path3).resolve().as_uri()
|
||||
c.notify("textDocument/didOpen", {"textDocument": {"uri": uri3, "languageId": "finch", "version": 1, "text": src3}})
|
||||
check("import as: compiles", c.diagnostics(uri3) == [])
|
||||
e3 = src3.replace(" print(", " pt.\n print(")
|
||||
c.notify("textDocument/didChange", {"textDocument": {"uri": uri3, "version": 2}, "contentChanges": [{"text": e3}]})
|
||||
comp = c.request("textDocument/completion", {"textDocument": {"uri": uri3}, "position": {"line": 3, "character": 7}})
|
||||
labels = [i["label"] for i in comp["items"]]
|
||||
check("completion: a module under another name", "base" in labels and "join" in labels, labels)
|
||||
|
||||
c.request("shutdown", None)
|
||||
c.notify("exit", None)
|
||||
c.p.wait(timeout=5)
|
||||
|
|
|
|||
Loading…
Reference in a new issue