@forinda/kickjs-view-language-server 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,10 @@ A language server for KickJS `.kick` views, built on [Volar](https://volarjs.dev
5
5
  - Errors as you type, from the same `parse` + `check` the runtime uses.
6
6
  - Completion for `@` keywords, pipes, components and their inputs, layout and slot names, and names in scope.
7
7
  - HTML, CSS and Emmet inside templates.
8
- - Hover, go to definition and formatting.
8
+ - Hover, go to definition, find references and formatting.
9
+ - Rename pipes, components and layouts across templates; renaming a template file updates its uses, `ctx.render('…')` calls in TS / JS included.
10
+ - Semantic tokens, so any LSP editor highlights the template syntax.
11
+ - In TypeScript and JavaScript files, template names in `ctx.render('…')` and `views.render('…')`: completion, go to definition, and a warning for a name with no template. Nothing else in those files is touched.
9
12
 
10
13
  When the client says the workspace is trusted, it loads the project's own `@forinda/kickjs-view` so the editor agrees with the build, and falls back to its bundled copy (with one warning) when the project has none.
11
14
 
@@ -25,6 +28,8 @@ Initialization options, relative to the workspace folder:
25
28
  | `viewsDir` | `src/views` |
26
29
  | `componentsDir` | `components` |
27
30
  | `pipesFile` | `<viewsDir>/pipes.ts` |
31
+ | `layout` | none — the same as `createViews({ layout })`: one name, or folder prefix → layout |
32
+ | `baseLayout` | none — the same as `createViews({ baseLayout })` |
28
33
  | `trusted` | `false` — only `true` imports the project's `@forinda/kickjs-view` (its code runs in the server) |
29
34
 
30
35
  Any file ending in `.kick` is a template, whatever `languageId` the editor sends. The custom request `kick/templateNames` returns every template name except components.
package/dist/index.d.ts CHANGED
@@ -12,6 +12,10 @@ interface ServerOptions {
12
12
  componentsDir?: string;
13
13
  /** Default `<viewsDir>/pipes.ts`. */
14
14
  pipesFile?: string;
15
+ /** `createViews({ layout })`: a page's layout when it declares none; one name, or folder prefix → layout. */
16
+ layout?: string | Record<string, string>;
17
+ /** `createViews({ baseLayout })`. */
18
+ baseLayout?: string;
15
19
  /**
16
20
  * The editor trusts the workspace, so the project's own `@forinda/kickjs-view`
17
21
  * may be imported. Otherwise the bundled copy is used. Default `false`.
@@ -46,6 +50,15 @@ interface WorkspaceOptions {
46
50
  read(path: string): Promise<string | undefined>;
47
51
  /** Every `.kick` file (absolute paths) under `dir`. */
48
52
  list(dir: string): Promise<string[]>;
53
+ /** `createViews({ layout })`: a page's layout when it declares none; one name, or folder prefix → layout. */
54
+ layout?: string | Record<string, string>;
55
+ /** `createViews({ baseLayout })`: the shell around every page's outermost layout. */
56
+ baseLayout?: string;
57
+ /** The project's TS / JS files with their text (an open buffer's when there is one), for `ctx.render('…')` names. */
58
+ scripts?(): Promise<Array<{
59
+ uri: string;
60
+ text: string;
61
+ }>>;
49
62
  }
50
63
  export declare class Workspace {
51
64
  private readonly opts;
@@ -57,6 +70,8 @@ export declare class Workspace {
57
70
  get view(): ViewModule;
58
71
  load(): Promise<void>;
59
72
  private nameOfPath;
73
+ /** `uri`'s path inside the views folder (`layouts/main.kick`, `layouts`); `undefined` outside it. */
74
+ relOf(uri: string): string | undefined;
60
75
  nameOf(uri: string): string | undefined;
61
76
  uriOf(name: string): string;
62
77
  componentsDir(): string;
@@ -82,6 +97,18 @@ export declare class Workspace {
82
97
  pipeDeclaration(name: string): PipeDeclaration | undefined;
83
98
  pipesFile(): string;
84
99
  project(): View.Project;
100
+ /** Templates that are layouts by configuration: the mapping's targets and the base layout. */
101
+ configuredLayouts(): Set<string>;
102
+ scripts(): Promise<Array<{
103
+ uri: string;
104
+ text: string;
105
+ }>>;
106
+ baseLayout(): string | undefined;
107
+ /**
108
+ * The layout `name` renders in: its own `@layout`, else the configured
109
+ * mapping's longest matching folder prefix (pages only, as `check` does).
110
+ */
111
+ layoutOf(name: string): string | undefined;
85
112
  /** Parse errors, else everything `check` reports — as LSP diagnostics. */
86
113
  diagnosticsFor(uri: string): Diagnostic[];
87
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/server.ts","../src/pipes.ts","../src/workspace.ts","../src/language-plugin.ts","../src/plugin/index.ts","../src/view-module.ts"],"mappings":";;;;;;;UAmBiB;;EAEf;;EAEA;;EAEA;;;;;EAKA;;wBAsBc;;;;;;;;UC/CC;;EAEf;EACA;EACA;;;;KCKU,oBAAoB;UAEf;EACf;;EAEA;EACA;;EAEA;EACA,MAAM;EACN,KAAK,eAAe;;EAEpB,KAAK,cAAc;;qBAaR;mBAMkB;mBALZ;mBACA;UACT;UACA;EAER,YAA6B,MAAM;MAE/B,QAAQ;EAIN,QAAQ;UAUN;EAMR,OAAO;EAIP,MAAM;EAIN;EAIA,OAAO;EAIP;EAIA,OAAO;EAKP,MAAM,eAAe,KAAK;;EAO1B,UAAU,aAAa;;EAYvB,KAAK,aAAa;EAIZ,YAAY,eAAe;EAc3B,YAAY,eAAe;UAenB;UAON;UA8BA;;UAMA;;EAkBR,aAAa,eAAe;EAc5B;;EAKA,gBAAgB,eAAe;EAI/B;EAIA,WAAW,KAAK;;EAShB,eAAe,cAAc;;;;qBCLlB,2BAA2B;WAOjB;WANZ;WACA;WACA,UAAU;WACV,UAAU;WACV,eAAe;EAExB,YAAqB;;qBA0CV,oBAAoB,eAAe;;;wBChRhC,wBAAwB,IAAI,YAAY;;;wBCmFlC,eACpB,cACA,OAAO;;AAEP,mBACC;EAAU,MAAM;EAAY;EAA+B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/server.ts","../src/pipes.ts","../src/workspace.ts","../src/language-plugin.ts","../src/plugin/index.ts","../src/view-module.ts"],"mappings":";;;;;;;UAoBiB;;EAEf;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB;;;;;EAKA;;wBAgEc;;;;;;;;UC9FC;;EAEf;EACA;EACA;;;;KCKU,oBAAoB;UAEf;EACf;;EAEA;EACA;;EAEA;EACA,MAAM;EACN,KAAK,eAAe;;EAEpB,KAAK,cAAc;;EAEnB,kBAAkB;;EAElB;;EAEA,YAAY,QAAQ;IAAQ;IAAa;;;qBAa9B;mBAMkB;mBALZ;mBACA;UACT;UACA;EAER,YAA6B,MAAM;MAE/B,QAAQ;EAIN,QAAQ;UAUN;;EAOR,MAAM;EAKN,OAAO;EAIP,MAAM;EAIN;EAIA,OAAO;EAIP;EAIA,OAAO;EAKP,MAAM,eAAe,KAAK;;EAO1B,UAAU,aAAa;;EAYvB,KAAK,aAAa;EAIZ,YAAY,eAAe;EAc3B,YAAY,eAAe;UAenB;UAON;UA8BA;;UAMA;;EAkBR,aAAa,eAAe;EAgB5B;;EAKA,gBAAgB,eAAe;EAI/B;EAIA,WAAW,KAAK;;EAWhB,qBAAqB;EAOrB,WAAW,QAAQ;IAAQ;IAAa;;EAIxC;;;;;EAQA,SAAS;;EAmBT,eAAe,cAAc;;;;qBC3BlB,2BAA2B;WAOjB;WANZ;WACA;WACA,UAAU;WACV,UAAU;WACV,eAAe;EAExB,YAAqB;;qBAgEV,oBAAoB,eAAe;;;wBCnUhC,wBAAwB,IAAI,YAAY;;;wBCgFlC,eACpB,cACA,OAAO;;AAEP,mBACC;EAAU,MAAM;EAAY;EAA+B"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-view-language-server v0.1.2
2
+ * @forinda/kickjs-view-language-server v0.3.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,4 +8,4 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- export { a as KickVirtualCode, n as Workspace, i as createKickServicePlugin, o as kickLanguagePlugin, r as loadViewModule, t as startServer } from "./server-CfzShU0v.js";
11
+ export { a as KickVirtualCode, n as Workspace, i as createKickServicePlugin, o as kickLanguagePlugin, r as loadViewModule, t as startServer } from "./server-Biz_hJF3.js";
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @forinda/kickjs-view-language-server v0.1.2
2
+ * @forinda/kickjs-view-language-server v0.3.0
3
3
  *
4
4
  * Copyright (c) Felix Orinda
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { t as startServer } from "./server-CfzShU0v.js";
11
+ import { t as startServer } from "./server-Biz_hJF3.js";
12
12
  //#region src/main.ts
13
13
  /** Runs the server — the entry editors launch (the bin and the VS Code bundle). */
14
14
  startServer();