@analogjs/language-server 0.1.4 → 0.1.6

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.
@@ -144,7 +144,11 @@ function createAnalogCode(snapshot) {
144
144
  if (root.tag === "script" &&
145
145
  root.startTagEnd !== undefined &&
146
146
  root.endTagStart !== undefined) {
147
- const text = snapshot.getText(root.startTagEnd, root.endTagStart);
147
+ const text = snapshot.getText(root.startTagEnd, root.endTagStart).replace(/(with(((\n|\s)*).*)})/gm, function (_, _$1, $2) {
148
+ // replace "with { analog: 'imports' }" with "/**with { analog: 'imports' }*/"
149
+ // so its not evaluated inside the script tag
150
+ return `/**${$2}*/`;
151
+ });
148
152
  const lang = root.attributes?.lang;
149
153
  const isTs = lang === "ts" || lang === '"ts"' || lang === "'ts'";
150
154
  yield {
@@ -152,16 +156,26 @@ function createAnalogCode(snapshot) {
152
156
  languageId: isTs ? "typescript" : "javascript",
153
157
  snapshot: {
154
158
  getText: (start, end) => `${text.substring(start, end)}
159
+
160
+ type AnalogComponentMetadata = Omit<import('@angular/core').Component, "template" |
161
+ "standalone" |
162
+ "changeDetection" |
163
+ "styles" |
164
+ "outputs" |
165
+ "inputs"> & { exposes?: any[] };
166
+
155
167
  /**
156
168
  * Defines additional metadata for the component such as the
157
169
  * selector, providers, and more.
158
170
  */
159
- declare function defineMetadata(metadata: {}): void;
171
+ declare function defineMetadata(metadata: AnalogComponentMetadata): void;
172
+
160
173
  /**
161
174
  * Defines the lifecycle hook(ngOnInit) that is called when the
162
175
  * component is initialized.
163
176
  */
164
- declare function onInit(destroyFn: () => void): void;
177
+ declare function onInit(initFn: () => void): void;
178
+
165
179
  /**
166
180
  * Defines the lifecycle hook(ngOnDestroy) that is called when the
167
181
  * component is destroyed.
@@ -217,7 +231,18 @@ declare function onDestroy(destroyFn: () => void): void;`,
217
231
  },
218
232
  },
219
233
  ],
220
- embeddedCodes: [],
234
+ embeddedCodes: [
235
+ {
236
+ id: "lang_" + langs + "_ts",
237
+ languageId: "typescript",
238
+ snapshot: {
239
+ getText: (_start, _end) => `increment();`,
240
+ getLength: () => `void increment;`.length,
241
+ getChangeRange: () => undefined,
242
+ },
243
+ mappings: []
244
+ }
245
+ ],
221
246
  };
222
247
  }
223
248
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@analogjs/language-server",
3
3
  "description": "LSP server for AnalogJS Language Service",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "main": "out/index.js",
6
6
  "license": "MIT",
7
7
  "scripts": {