feat(editor): complete the apis block and drop the removed snippets
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -306,6 +306,54 @@ const BLOCK_COMPLETIONS = [
|
||||
"}",
|
||||
].join("\n"),
|
||||
},
|
||||
{
|
||||
label: "apis",
|
||||
detail: "Page-level API call declarations block",
|
||||
documentation:
|
||||
"Declare the API calls available to this page as named entries, each callable via api.<name>() from functions and the `api=` view binding.",
|
||||
snippet: [
|
||||
"apis {",
|
||||
" ${1:searchUsers} ${2|GET,POST,PUT,PATCH,DELETE|} ${3:/api/users} {",
|
||||
" request {",
|
||||
" body {",
|
||||
" ${4:name}?: ${5:string}",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" response {",
|
||||
" return ${6:data}",
|
||||
" }",
|
||||
"",
|
||||
" error {",
|
||||
" return ${7:null}",
|
||||
" }",
|
||||
" }",
|
||||
"}",
|
||||
].join("\n"),
|
||||
},
|
||||
{
|
||||
label: "apis entry",
|
||||
detail: "Single API call declaration",
|
||||
documentation:
|
||||
"Declare a single named API call inside an apis { } block: <name> <METHOD> <path> { request/response/error }.",
|
||||
snippet: [
|
||||
"${1:searchUsers} ${2|GET,POST,PUT,PATCH,DELETE|} ${3:/api/users} {",
|
||||
" request {",
|
||||
" body {",
|
||||
" ${4:name}?: ${5:string}",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" response {",
|
||||
" return ${6:data}",
|
||||
" }",
|
||||
"",
|
||||
" error {",
|
||||
" return ${7:null}",
|
||||
" }",
|
||||
"}",
|
||||
].join("\n"),
|
||||
},
|
||||
{
|
||||
label: "persist",
|
||||
detail: "Include-only store persistence",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// WRN editor extension source hash: 01c5b97824df25422267667a6083adbdc0a5dc14ae7fbec5345084a214d40523
|
||||
// WRN editor extension source hash: d0ca0feee6516ae43e902e6aea0424bc5c3d05790708eb8a8c68c98162eb99bb
|
||||
// WRN editor extension generator hash: 456d1d614e44e5fb1f19b784176c09cf2ade9b64ef73a17934c2698150b62728
|
||||
"use strict";
|
||||
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// WRN editor language server source hash: 92a9c7cd3babafdbc518a6f20c0c8f0025e49e92a28a2fa5598c8bb7a858e800
|
||||
// WRN editor language server source hash: f75d793688bdb42225d2314660c87852a108b76311974be9307d11e42ecfbb41
|
||||
// WRN editor language server generator hash: f593a44aaf05495b789ce7a3086bee1eebb951b884d41c0e017bbcfe5f547e72
|
||||
// @bun @bun-cjs
|
||||
(function(exports, require, module, __filename, __dirname) {var __create = Object.create;
|
||||
@@ -173590,7 +173590,7 @@ function htmlToWrn(html, name = "ImportedPage") {
|
||||
}
|
||||
|
||||
// packages/language-server/src/index.ts
|
||||
var WRN_COMPLETIONS = [
|
||||
var WRN_KEYWORDS = [
|
||||
"page",
|
||||
"component",
|
||||
"layout",
|
||||
@@ -173604,6 +173604,7 @@ var WRN_COMPLETIONS = [
|
||||
"load",
|
||||
"action",
|
||||
"api",
|
||||
"apis",
|
||||
"realtime",
|
||||
"view",
|
||||
"style",
|
||||
@@ -173766,7 +173767,7 @@ ${declaration[0]}
|
||||
};
|
||||
}
|
||||
function completionItems() {
|
||||
return WRN_COMPLETIONS.map((label) => ({ label, kind: 14, detail: "WRNexus language keyword" }));
|
||||
return WRN_KEYWORDS.map((label) => ({ label, kind: 14, detail: "WRNexus language keyword" }));
|
||||
}
|
||||
var semanticTokenTypes = ["variable"];
|
||||
var semanticTokenModifiers = ["declaration", "modification"];
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface TextDocument {
|
||||
version?: number;
|
||||
}
|
||||
|
||||
export const WRN_COMPLETIONS = [
|
||||
export const WRN_KEYWORDS = [
|
||||
"page",
|
||||
"component",
|
||||
"layout",
|
||||
@@ -29,6 +29,7 @@ export const WRN_COMPLETIONS = [
|
||||
"load",
|
||||
"action",
|
||||
"api",
|
||||
"apis",
|
||||
"realtime",
|
||||
"view",
|
||||
"style",
|
||||
@@ -237,7 +238,7 @@ export function hover(document: TextDocument, position: Position) {
|
||||
}
|
||||
|
||||
export function completionItems() {
|
||||
return WRN_COMPLETIONS.map((label) => ({ label, kind: 14, detail: "WRNexus language keyword" }));
|
||||
return WRN_KEYWORDS.map((label) => ({ label, kind: 14, detail: "WRNexus language keyword" }));
|
||||
}
|
||||
|
||||
const semanticTokenTypes = ["variable"] as const;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { WRN_KEYWORDS } from "../src/index.ts";
|
||||
|
||||
test("apis is a known page-level keyword", () => {
|
||||
expect(WRN_KEYWORDS).toContain("apis");
|
||||
});
|
||||
Reference in New Issue
Block a user